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