| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 11 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
| 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 12 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 13 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
| 14 #if defined(TOOLKIT_VIEWS) | 14 #if defined(TOOLKIT_VIEWS) |
| 15 #include "chrome/browser/views/extensions/extension_view.h" | 15 #include "chrome/browser/views/extensions/extension_view.h" |
| 16 #elif defined(OS_LINUX) | 16 #elif defined(OS_LINUX) |
| 17 #include "chrome/browser/gtk/extension_view_gtk.h" | 17 #include "chrome/browser/gtk/extension_view_gtk.h" |
| 18 #elif defined(OS_MACOSX) |
| 19 #include "chrome/browser/cocoa/extension_view_mac.h" |
| 18 #endif | 20 #endif |
| 19 #include "chrome/common/notification_registrar.h" | 21 #include "chrome/common/notification_registrar.h" |
| 20 | 22 |
| 21 class Browser; | 23 class Browser; |
| 22 class Extension; | 24 class Extension; |
| 23 class ExtensionProcessManager; | 25 class ExtensionProcessManager; |
| 24 class RenderProcessHost; | 26 class RenderProcessHost; |
| 25 class RenderWidgetHost; | 27 class RenderWidgetHost; |
| 26 class RenderWidgetHostView; | 28 class RenderWidgetHostView; |
| 27 class TabContents; | 29 class TabContents; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 | 43 |
| 42 ExtensionHost(Extension* extension, SiteInstance* site_instance, | 44 ExtensionHost(Extension* extension, SiteInstance* site_instance, |
| 43 const GURL& url, ViewType::Type host_type); | 45 const GURL& url, ViewType::Type host_type); |
| 44 ~ExtensionHost(); | 46 ~ExtensionHost(); |
| 45 | 47 |
| 46 #if defined(TOOLKIT_VIEWS) | 48 #if defined(TOOLKIT_VIEWS) |
| 47 void set_view(ExtensionView* view) { view_.reset(view); } | 49 void set_view(ExtensionView* view) { view_.reset(view); } |
| 48 ExtensionView* view() const { return view_.get(); } | 50 ExtensionView* view() const { return view_.get(); } |
| 49 #elif defined(OS_LINUX) | 51 #elif defined(OS_LINUX) |
| 50 ExtensionViewGtk* view() const { return view_.get(); } | 52 ExtensionViewGtk* view() const { return view_.get(); } |
| 53 #elif defined(OS_MACOSX) |
| 54 ExtensionViewMac* view() const { return view_.get(); } |
| 51 #else | 55 #else |
| 52 // TODO(port): implement | 56 // TODO(port): implement |
| 53 void* view() const { return NULL; } | 57 void* view() const { return NULL; } |
| 54 #endif | 58 #endif |
| 55 | 59 |
| 56 // Create an ExtensionView and tie it to this host and |browser|. | 60 // Create an ExtensionView and tie it to this host and |browser|. |
| 57 void CreateView(Browser* browser); | 61 void CreateView(Browser* browser); |
| 58 | 62 |
| 59 Extension* extension() { return extension_; } | 63 Extension* extension() { return extension_; } |
| 60 RenderViewHost* render_view_host() const { return render_view_host_; } | 64 RenderViewHost* render_view_host() const { return render_view_host_; } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 Extension* extension_; | 155 Extension* extension_; |
| 152 | 156 |
| 153 // The profile that this host is tied to. | 157 // The profile that this host is tied to. |
| 154 Profile* profile_; | 158 Profile* profile_; |
| 155 | 159 |
| 156 // Optional view that shows the rendered content in the UI. | 160 // Optional view that shows the rendered content in the UI. |
| 157 #if defined(TOOLKIT_VIEWS) | 161 #if defined(TOOLKIT_VIEWS) |
| 158 scoped_ptr<ExtensionView> view_; | 162 scoped_ptr<ExtensionView> view_; |
| 159 #elif defined(OS_LINUX) | 163 #elif defined(OS_LINUX) |
| 160 scoped_ptr<ExtensionViewGtk> view_; | 164 scoped_ptr<ExtensionViewGtk> view_; |
| 165 #elif defined(OS_MACOSX) |
| 166 scoped_ptr<ExtensionViewMac> view_; |
| 161 #endif | 167 #endif |
| 162 | 168 |
| 163 // The host for our HTML content. | 169 // The host for our HTML content. |
| 164 RenderViewHost* render_view_host_; | 170 RenderViewHost* render_view_host_; |
| 165 | 171 |
| 166 // Common implementations of some RenderViewHostDelegate::View methods. | 172 // Common implementations of some RenderViewHostDelegate::View methods. |
| 167 RenderViewHostDelegateViewHelper delegate_view_helper_; | 173 RenderViewHostDelegateViewHelper delegate_view_helper_; |
| 168 | 174 |
| 169 // Whether the RenderWidget has reported that it has stopped loading. | 175 // Whether the RenderWidget has reported that it has stopped loading. |
| 170 bool did_stop_loading_; | 176 bool did_stop_loading_; |
| 171 | 177 |
| 172 // True if the main frame has finished parsing. | 178 // True if the main frame has finished parsing. |
| 173 bool document_element_available_; | 179 bool document_element_available_; |
| 174 | 180 |
| 175 // The URL being hosted. | 181 // The URL being hosted. |
| 176 GURL url_; | 182 GURL url_; |
| 177 | 183 |
| 178 NotificationRegistrar registrar_; | 184 NotificationRegistrar registrar_; |
| 179 | 185 |
| 180 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 186 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 181 | 187 |
| 182 // Only EXTENSION_TOOLSTRIP and EXTENSION_BACKGROUND_PAGE are used here, | 188 // Only EXTENSION_TOOLSTRIP and EXTENSION_BACKGROUND_PAGE are used here, |
| 183 // others are not hostd by ExtensionHost. | 189 // others are not hostd by ExtensionHost. |
| 184 ViewType::Type extension_host_type_; | 190 ViewType::Type extension_host_type_; |
| 185 | 191 |
| 186 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 192 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 187 }; | 193 }; |
| 188 | 194 |
| 189 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 195 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |