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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // event in platform specific way. | 235 // event in platform specific way. |
235 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 236 virtual void UnhandledKeyboardEvent(const NativeWebKeyboardEvent& event) {} |
236 | 237 |
237 // Returns true if we're hosting a background page. | 238 // Returns true if we're hosting a background page. |
238 // This isn't valid until CreateRenderView is called. | 239 // This isn't valid until CreateRenderView is called. |
239 bool is_background_page() const { return !view(); } | 240 bool is_background_page() const { return !view(); } |
240 | 241 |
241 // The extension that we're hosting in this view. | 242 // The extension that we're hosting in this view. |
242 const Extension* extension_; | 243 const Extension* extension_; |
243 | 244 |
| 245 // Id of extension that we're hosting in this view. |
| 246 const std::string extension_id_; |
| 247 |
244 // The profile that this host is tied to. | 248 // The profile that this host is tied to. |
245 Profile* profile_; | 249 Profile* profile_; |
246 | 250 |
247 // Optional view that shows the rendered content in the UI. | 251 // Optional view that shows the rendered content in the UI. |
248 #if defined(TOOLKIT_VIEWS) | 252 #if defined(TOOLKIT_VIEWS) |
249 scoped_ptr<ExtensionView> view_; | 253 scoped_ptr<ExtensionView> view_; |
250 #elif defined(OS_MACOSX) | 254 #elif defined(OS_MACOSX) |
251 scoped_ptr<ExtensionViewMac> view_; | 255 scoped_ptr<ExtensionViewMac> view_; |
252 #elif defined(TOOLKIT_GTK) | 256 #elif defined(TOOLKIT_GTK) |
253 scoped_ptr<ExtensionViewGtk> view_; | 257 scoped_ptr<ExtensionViewGtk> view_; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // The time that the last javascript message was dismissed. | 292 // The time that the last javascript message was dismissed. |
289 base::TimeTicks last_javascript_message_dismissal_; | 293 base::TimeTicks last_javascript_message_dismissal_; |
290 | 294 |
291 // Whether to suppress all javascript messages. | 295 // Whether to suppress all javascript messages. |
292 bool suppress_javascript_messages_; | 296 bool suppress_javascript_messages_; |
293 | 297 |
294 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 298 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
295 }; | 299 }; |
296 | 300 |
297 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 301 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |