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 19 matching lines...) Expand all Loading... |
30 class FileSelectHelper; | 30 class FileSelectHelper; |
31 class RenderProcessHost; | 31 class RenderProcessHost; |
32 class RenderWidgetHostView; | 32 class RenderWidgetHostView; |
33 class TabContents; | 33 class TabContents; |
34 struct ViewHostMsg_RunFileChooser_Params; | 34 struct ViewHostMsg_RunFileChooser_Params; |
35 struct WebPreferences; | 35 struct WebPreferences; |
36 | 36 |
37 // This class is the browser component of an extension component's RenderView. | 37 // This class is the browser component of an extension component's RenderView. |
38 // It handles setting up the renderer process, if needed, with special | 38 // It handles setting up the renderer process, if needed, with special |
39 // privileges available to extensions. It may have a view to be shown in the | 39 // privileges available to extensions. It may have a view to be shown in the |
40 // in the browser UI, or it may be hidden. | 40 // browser UI, or it may be hidden. |
41 class ExtensionHost : public RenderViewHostDelegate, | 41 class ExtensionHost : public RenderViewHostDelegate, |
42 public RenderViewHostDelegate::View, | 42 public RenderViewHostDelegate::View, |
43 public ExtensionFunctionDispatcher::Delegate, | 43 public ExtensionFunctionDispatcher::Delegate, |
44 public NotificationObserver, | 44 public NotificationObserver, |
45 public JavaScriptAppModalDialogDelegate { | 45 public JavaScriptAppModalDialogDelegate { |
46 public: | 46 public: |
47 class ProcessCreationQueue; | 47 class ProcessCreationQueue; |
48 | 48 |
49 // Enable DOM automation in created render view hosts. | 49 // Enable DOM automation in created render view hosts. |
50 static void EnableDOMAutomation() { enable_dom_automation_ = true; } | 50 static void EnableDOMAutomation() { enable_dom_automation_ = true; } |
(...skipping 14 matching lines...) Expand all Loading... |
65 ExtensionViewGtk* view() { return view_.get(); } | 65 ExtensionViewGtk* view() { return view_.get(); } |
66 #endif | 66 #endif |
67 | 67 |
68 // Create an ExtensionView and tie it to this host and |browser|. Note NULL | 68 // Create an ExtensionView and tie it to this host and |browser|. Note NULL |
69 // is a valid argument for |browser|. Extension views may be bound to | 69 // is a valid argument for |browser|. Extension views may be bound to |
70 // tab-contents hosted in ExternalTabContainer objects, which do not | 70 // tab-contents hosted in ExternalTabContainer objects, which do not |
71 // instantiate Browser objects. | 71 // instantiate Browser objects. |
72 void CreateView(Browser* browser); | 72 void CreateView(Browser* browser); |
73 | 73 |
74 const Extension* extension() const { return extension_; } | 74 const Extension* extension() const { return extension_; } |
| 75 const std::string& extension_id() const { return extension_id_; } |
75 RenderViewHost* render_view_host() const { return render_view_host_; } | 76 RenderViewHost* render_view_host() const { return render_view_host_; } |
76 RenderProcessHost* render_process_host() const; | 77 RenderProcessHost* render_process_host() const; |
77 SiteInstance* site_instance() const; | 78 SiteInstance* site_instance() const; |
78 bool did_stop_loading() const { return did_stop_loading_; } | 79 bool did_stop_loading() const { return did_stop_loading_; } |
79 bool document_element_available() const { | 80 bool document_element_available() const { |
80 return document_element_available_; | 81 return document_element_available_; |
81 } | 82 } |
82 | 83 |
83 Profile* profile() const { return profile_; } | 84 Profile* profile() const { return profile_; } |
84 | 85 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // event in platform specific way. | 237 // event in platform specific way. |
237 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 238 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} |
238 | 239 |
239 // Returns true if we're hosting a background page. | 240 // Returns true if we're hosting a background page. |
240 // This isn't valid until CreateRenderView is called. | 241 // This isn't valid until CreateRenderView is called. |
241 bool is_background_page() const { return !view(); } | 242 bool is_background_page() const { return !view(); } |
242 | 243 |
243 // The extension that we're hosting in this view. | 244 // The extension that we're hosting in this view. |
244 const Extension* extension_; | 245 const Extension* extension_; |
245 | 246 |
| 247 // Id of extension that we're hosting in this view. |
| 248 const std::string extension_id_; |
| 249 |
246 // The profile that this host is tied to. | 250 // The profile that this host is tied to. |
247 Profile* profile_; | 251 Profile* profile_; |
248 | 252 |
249 // Optional view that shows the rendered content in the UI. | 253 // Optional view that shows the rendered content in the UI. |
250 #if defined(TOOLKIT_VIEWS) | 254 #if defined(TOOLKIT_VIEWS) |
251 scoped_ptr<ExtensionView> view_; | 255 scoped_ptr<ExtensionView> view_; |
252 #elif defined(OS_MACOSX) | 256 #elif defined(OS_MACOSX) |
253 scoped_ptr<ExtensionViewMac> view_; | 257 scoped_ptr<ExtensionViewMac> view_; |
254 #elif defined(TOOLKIT_GTK) | 258 #elif defined(TOOLKIT_GTK) |
255 scoped_ptr<ExtensionViewGtk> view_; | 259 scoped_ptr<ExtensionViewGtk> view_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // The time that the last javascript message was dismissed. | 294 // The time that the last javascript message was dismissed. |
291 base::TimeTicks last_javascript_message_dismissal_; | 295 base::TimeTicks last_javascript_message_dismissal_; |
292 | 296 |
293 // Whether to suppress all javascript messages. | 297 // Whether to suppress all javascript messages. |
294 bool suppress_javascript_messages_; | 298 bool suppress_javascript_messages_; |
295 | 299 |
296 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 300 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
297 }; | 301 }; |
298 | 302 |
299 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 303 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |