| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #elif defined(OS_MACOSX) | 22 #elif defined(OS_MACOSX) |
| 23 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 23 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
| 24 #elif defined(TOOLKIT_GTK) | 24 #elif defined(TOOLKIT_GTK) |
| 25 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 25 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 class Browser; | 28 class Browser; |
| 29 class DesktopNotificationHandler; | 29 class DesktopNotificationHandler; |
| 30 class DevToolsHandler; | 30 class DevToolsHandler; |
| 31 class Extension; | 31 class Extension; |
| 32 class ExtensionMessageHandler; |
| 32 class FileSelectHelper; | 33 class FileSelectHelper; |
| 33 class RenderProcessHost; | 34 class RenderProcessHost; |
| 34 class RenderWidgetHostView; | 35 class RenderWidgetHostView; |
| 35 class TabContents; | 36 class TabContents; |
| 36 struct ViewHostMsg_RunFileChooser_Params; | 37 struct ViewHostMsg_RunFileChooser_Params; |
| 37 struct WebPreferences; | 38 struct WebPreferences; |
| 38 | 39 |
| 39 // This class is the browser component of an extension component's RenderView. | 40 // This class is the browser component of an extension component's RenderView. |
| 40 // It handles setting up the renderer process, if needed, with special | 41 // It handles setting up the renderer process, if needed, with special |
| 41 // privileges available to extensions. It may have a view to be shown in the | 42 // privileges available to extensions. It may have a view to be shown in the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const ViewHostMsg_FrameNavigate_Params& params); | 124 const ViewHostMsg_FrameNavigate_Params& params); |
| 124 virtual void DidStopLoading(); | 125 virtual void DidStopLoading(); |
| 125 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); | 126 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); |
| 126 virtual void DocumentOnLoadCompletedInMainFrame( | 127 virtual void DocumentOnLoadCompletedInMainFrame( |
| 127 RenderViewHost* render_view_host, | 128 RenderViewHost* render_view_host, |
| 128 int32 page_id); | 129 int32 page_id); |
| 129 | 130 |
| 130 // RenderViewHostDelegate implementation. | 131 // RenderViewHostDelegate implementation. |
| 131 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 132 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
| 132 virtual WebPreferences GetWebkitPrefs(); | 133 virtual WebPreferences GetWebkitPrefs(); |
| 133 virtual void ProcessWebUIMessage( | |
| 134 const ExtensionHostMsg_DomMessage_Params& params); | |
| 135 virtual void RunJavaScriptMessage(const std::wstring& message, | 134 virtual void RunJavaScriptMessage(const std::wstring& message, |
| 136 const std::wstring& default_prompt, | 135 const std::wstring& default_prompt, |
| 137 const GURL& frame_url, | 136 const GURL& frame_url, |
| 138 const int flags, | 137 const int flags, |
| 139 IPC::Message* reply_msg, | 138 IPC::Message* reply_msg, |
| 140 bool* did_suppress_message); | 139 bool* did_suppress_message); |
| 141 virtual void Close(RenderViewHost* render_view_host); | 140 virtual void Close(RenderViewHost* render_view_host); |
| 142 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; | 141 virtual RendererPreferences GetRendererPrefs(Profile* profile) const; |
| 143 | 142 |
| 144 // RenderViewHostDelegate::View | 143 // RenderViewHostDelegate::View |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 224 |
| 226 // Const version of below function. | 225 // Const version of below function. |
| 227 const Browser* GetBrowser() const; | 226 const Browser* GetBrowser() const; |
| 228 | 227 |
| 229 // ExtensionFunctionDispatcher::Delegate | 228 // ExtensionFunctionDispatcher::Delegate |
| 230 virtual Browser* GetBrowser(); | 229 virtual Browser* GetBrowser(); |
| 231 virtual gfx::NativeView GetNativeViewOfHost(); | 230 virtual gfx::NativeView GetNativeViewOfHost(); |
| 232 | 231 |
| 233 // Message handlers. | 232 // Message handlers. |
| 234 void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params); | 233 void OnRunFileChooser(const ViewHostMsg_RunFileChooser_Params& params); |
| 235 void OnPostMessage(int port_id, const std::string& message); | |
| 236 | 234 |
| 237 // Handles keyboard events that were not handled by HandleKeyboardEvent(). | 235 // Handles keyboard events that were not handled by HandleKeyboardEvent(). |
| 238 // Platform specific implementation may override this method to handle the | 236 // Platform specific implementation may override this method to handle the |
| 239 // event in platform specific way. | 237 // event in platform specific way. |
| 240 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 238 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} |
| 241 | 239 |
| 240 // Updates extension_function_dispatcher_. Call this instead of modifying it |
| 241 // directly. |
| 242 void SetExtensionFunctionDispatcher(ExtensionFunctionDispatcher* efd); |
| 243 |
| 242 // Returns true if we're hosting a background page. | 244 // Returns true if we're hosting a background page. |
| 243 // This isn't valid until CreateRenderView is called. | 245 // This isn't valid until CreateRenderView is called. |
| 244 bool is_background_page() const { return !view(); } | 246 bool is_background_page() const { return !view(); } |
| 245 | 247 |
| 246 // The extension that we're hosting in this view. | 248 // The extension that we're hosting in this view. |
| 247 const Extension* extension_; | 249 const Extension* extension_; |
| 248 | 250 |
| 249 // The profile that this host is tied to. | 251 // The profile that this host is tied to. |
| 250 Profile* profile_; | 252 Profile* profile_; |
| 251 | 253 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 291 |
| 290 // FileSelectHelper, lazily created. | 292 // FileSelectHelper, lazily created. |
| 291 scoped_ptr<FileSelectHelper> file_select_helper_; | 293 scoped_ptr<FileSelectHelper> file_select_helper_; |
| 292 | 294 |
| 293 // Handles desktop notification IPCs. | 295 // Handles desktop notification IPCs. |
| 294 scoped_ptr<DesktopNotificationHandler> desktop_notification_handler_; | 296 scoped_ptr<DesktopNotificationHandler> desktop_notification_handler_; |
| 295 | 297 |
| 296 // Filters dev tools IPCs. | 298 // Filters dev tools IPCs. |
| 297 scoped_ptr<DevToolsHandler> dev_tools_handler_; | 299 scoped_ptr<DevToolsHandler> dev_tools_handler_; |
| 298 | 300 |
| 301 // Handles extension IPCs. |
| 302 scoped_ptr<ExtensionMessageHandler> extension_message_handler_; |
| 303 |
| 299 // The time that the last javascript message was dismissed. | 304 // The time that the last javascript message was dismissed. |
| 300 base::TimeTicks last_javascript_message_dismissal_; | 305 base::TimeTicks last_javascript_message_dismissal_; |
| 301 | 306 |
| 302 // Whether to suppress all javascript messages. | 307 // Whether to suppress all javascript messages. |
| 303 bool suppress_javascript_messages_; | 308 bool suppress_javascript_messages_; |
| 304 | 309 |
| 305 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 310 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 306 }; | 311 }; |
| 307 | 312 |
| 308 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 313 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |