OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/perftimer.h" | 13 #include "base/perftimer.h" |
14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
15 #include "chrome/common/view_type.h" | |
16 #include "content/public/browser/javascript_dialog_manager.h" | 15 #include "content/public/browser/javascript_dialog_manager.h" |
17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_contents_delegate.h" | 18 #include "content/public/browser/web_contents_delegate.h" |
20 #include "content/public/browser/web_contents_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
20 #include "extensions/common/view_type.h" | |
21 | 21 |
22 #if defined(TOOLKIT_VIEWS) | 22 #if defined(TOOLKIT_VIEWS) |
23 #include "chrome/browser/ui/views/extensions/extension_view_views.h" | 23 #include "chrome/browser/ui/views/extensions/extension_view_views.h" |
24 #elif defined(OS_MACOSX) | 24 #elif defined(OS_MACOSX) |
25 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" | 25 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" |
26 #elif defined(TOOLKIT_GTK) | 26 #elif defined(TOOLKIT_GTK) |
27 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" | 27 #include "chrome/browser/ui/gtk/extensions/extension_view_gtk.h" |
28 #elif defined(OS_ANDROID) | 28 #elif defined(OS_ANDROID) |
29 #include "chrome/browser/ui/android/extensions/extension_view_android.h" | 29 #include "chrome/browser/ui/android/extensions/extension_view_android.h" |
30 #endif | 30 #endif |
(...skipping 28 matching lines...) Expand all Loading... | |
59 typedef ExtensionViewMac PlatformExtensionView; | 59 typedef ExtensionViewMac PlatformExtensionView; |
60 #elif defined(TOOLKIT_GTK) | 60 #elif defined(TOOLKIT_GTK) |
61 typedef ExtensionViewGtk PlatformExtensionView; | 61 typedef ExtensionViewGtk PlatformExtensionView; |
62 #elif defined(OS_ANDROID) | 62 #elif defined(OS_ANDROID) |
63 // Android does not support extensions. | 63 // Android does not support extensions. |
64 typedef ExtensionViewAndroid PlatformExtensionView; | 64 typedef ExtensionViewAndroid PlatformExtensionView; |
65 #endif | 65 #endif |
66 | 66 |
67 ExtensionHost(const Extension* extension, | 67 ExtensionHost(const Extension* extension, |
68 content::SiteInstance* site_instance, | 68 content::SiteInstance* site_instance, |
69 const GURL& url, chrome::ViewType host_type); | 69 const GURL& url, extensions::ViewType host_type); |
Yoyo Zhou
2013/04/01 17:36:51
''
| |
70 virtual ~ExtensionHost(); | 70 virtual ~ExtensionHost(); |
71 | 71 |
72 #if defined(TOOLKIT_VIEWS) | 72 #if defined(TOOLKIT_VIEWS) |
73 void set_view(PlatformExtensionView* view) { view_.reset(view); } | 73 void set_view(PlatformExtensionView* view) { view_.reset(view); } |
74 #endif | 74 #endif |
75 | 75 |
76 const PlatformExtensionView* view() const { | 76 const PlatformExtensionView* view() const { |
77 #if defined(OS_ANDROID) | 77 #if defined(OS_ANDROID) |
78 NOTREACHED(); | 78 NOTREACHED(); |
79 #endif | 79 #endif |
(...skipping 18 matching lines...) Expand all Loading... | |
98 content::WebContents* host_contents() const { return host_contents_.get(); } | 98 content::WebContents* host_contents() const { return host_contents_.get(); } |
99 content::RenderViewHost* render_view_host() const; | 99 content::RenderViewHost* render_view_host() const; |
100 content::RenderProcessHost* render_process_host() const; | 100 content::RenderProcessHost* render_process_host() const; |
101 bool did_stop_loading() const { return did_stop_loading_; } | 101 bool did_stop_loading() const { return did_stop_loading_; } |
102 bool document_element_available() const { | 102 bool document_element_available() const { |
103 return document_element_available_; | 103 return document_element_available_; |
104 } | 104 } |
105 | 105 |
106 Profile* profile() const { return profile_; } | 106 Profile* profile() const { return profile_; } |
107 | 107 |
108 chrome::ViewType extension_host_type() const { return extension_host_type_; } | 108 extensions::ViewType extension_host_type() const { |
109 return extension_host_type_; | |
110 } | |
109 const GURL& GetURL() const; | 111 const GURL& GetURL() const; |
110 | 112 |
111 // ExtensionFunctionDispatcher::Delegate | 113 // ExtensionFunctionDispatcher::Delegate |
112 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 114 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
113 void SetAssociatedWebContents(content::WebContents* web_contents); | 115 void SetAssociatedWebContents(content::WebContents* web_contents); |
114 | 116 |
115 // Returns true if the render view is initialized and didn't crash. | 117 // Returns true if the render view is initialized and didn't crash. |
116 bool IsRenderViewLive() const; | 118 bool IsRenderViewLive() const; |
117 | 119 |
118 // Prepares to initializes our RenderViewHost by creating its RenderView and | 120 // Prepares to initializes our RenderViewHost by creating its RenderView and |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 bool document_element_available_; | 242 bool document_element_available_; |
241 | 243 |
242 // The original URL of the page being hosted. | 244 // The original URL of the page being hosted. |
243 GURL initial_url_; | 245 GURL initial_url_; |
244 | 246 |
245 content::NotificationRegistrar registrar_; | 247 content::NotificationRegistrar registrar_; |
246 | 248 |
247 ExtensionFunctionDispatcher extension_function_dispatcher_; | 249 ExtensionFunctionDispatcher extension_function_dispatcher_; |
248 | 250 |
249 // The type of view being hosted. | 251 // The type of view being hosted. |
250 chrome::ViewType extension_host_type_; | 252 extensions::ViewType extension_host_type_; |
251 | 253 |
252 // The relevant WebContents associated with this ExtensionHost, if any. | 254 // The relevant WebContents associated with this ExtensionHost, if any. |
253 content::WebContents* associated_web_contents_; | 255 content::WebContents* associated_web_contents_; |
254 | 256 |
255 // Used to measure how long it's been since the host was created. | 257 // Used to measure how long it's been since the host was created. |
256 PerfTimer since_created_; | 258 PerfTimer since_created_; |
257 | 259 |
258 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 260 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
259 }; | 261 }; |
260 | 262 |
261 } // namespace extensions | 263 } // namespace extensions |
262 | 264 |
263 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 265 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |