| 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/perftimer.h" | 10 #include "base/perftimer.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 ExtensionView* view() const { return view_.get(); } | 58 ExtensionView* view() const { return view_.get(); } |
| 59 #elif defined(OS_LINUX) | 59 #elif defined(OS_LINUX) |
| 60 ExtensionViewGtk* view() const { return view_.get(); } | 60 ExtensionViewGtk* view() const { return view_.get(); } |
| 61 #elif defined(OS_MACOSX) | 61 #elif defined(OS_MACOSX) |
| 62 ExtensionViewMac* view() const { return view_.get(); } | 62 ExtensionViewMac* view() const { return view_.get(); } |
| 63 #else | 63 #else |
| 64 // TODO(port): implement | 64 // TODO(port): implement |
| 65 void* view() const { return NULL; } | 65 void* view() const { return NULL; } |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 // Create an ExtensionView and tie it to this host and |browser|. | 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 |
| 70 // tab-contents hosted in ExternalTabContainer objects, which do not |
| 71 // instantiate Browser objects. |
| 69 void CreateView(Browser* browser); | 72 void CreateView(Browser* browser); |
| 70 | 73 |
| 71 Extension* extension() { return extension_; } | 74 Extension* extension() { return extension_; } |
| 72 RenderViewHost* render_view_host() const { return render_view_host_; } | 75 RenderViewHost* render_view_host() const { return render_view_host_; } |
| 73 RenderProcessHost* render_process_host() const; | 76 RenderProcessHost* render_process_host() const; |
| 74 SiteInstance* site_instance() const; | 77 SiteInstance* site_instance() const; |
| 75 bool did_stop_loading() const { return did_stop_loading_; } | 78 bool did_stop_loading() const { return did_stop_loading_; } |
| 76 bool document_element_available() const { | 79 bool document_element_available() const { |
| 77 return document_element_available_; | 80 return document_element_available_; |
| 78 } | 81 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // for testing. | 169 // for testing. |
| 167 static bool enable_dom_automation_; | 170 static bool enable_dom_automation_; |
| 168 | 171 |
| 169 // Actually create the RenderView for this host. See CreateRenderViewSoon. | 172 // Actually create the RenderView for this host. See CreateRenderViewSoon. |
| 170 void CreateRenderViewNow(); | 173 void CreateRenderViewNow(); |
| 171 | 174 |
| 172 // ExtensionFunctionDispatcher::Delegate | 175 // ExtensionFunctionDispatcher::Delegate |
| 173 // If this ExtensionHost has a view, this returns the Browser that view is a | 176 // If this ExtensionHost has a view, this returns the Browser that view is a |
| 174 // part of. If this is a global background page, we use the active Browser | 177 // part of. If this is a global background page, we use the active Browser |
| 175 // instead. | 178 // instead. |
| 176 virtual Browser* GetBrowser(); | 179 virtual Browser* GetBrowser() const; |
| 177 virtual ExtensionHost* GetExtensionHost() { return this; } | 180 virtual ExtensionHost* GetExtensionHost() { return this; } |
| 178 | 181 |
| 179 // ExtensionPopupHost::Delegate | 182 // ExtensionPopupHost::Delegate |
| 180 virtual RenderViewHost* GetRenderViewHost() { return render_view_host(); } | 183 virtual RenderViewHost* GetRenderViewHost() { return render_view_host(); } |
| 181 | 184 |
| 182 // Returns true if we're hosting a background page. | 185 // Returns true if we're hosting a background page. |
| 183 // This isn't valid until CreateRenderView is called. | 186 // This isn't valid until CreateRenderView is called. |
| 184 bool is_background_page() const { return !view(); } | 187 bool is_background_page() const { return !view(); } |
| 185 | 188 |
| 186 // The extension that we're hosting in this view. | 189 // The extension that we're hosting in this view. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // are used here, others are not hosted by ExtensionHost. | 224 // are used here, others are not hosted by ExtensionHost. |
| 222 ViewType::Type extension_host_type_; | 225 ViewType::Type extension_host_type_; |
| 223 | 226 |
| 224 // Used to measure how long it's been since the host was created. | 227 // Used to measure how long it's been since the host was created. |
| 225 PerfTimer since_created_; | 228 PerfTimer since_created_; |
| 226 | 229 |
| 227 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 230 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 228 }; | 231 }; |
| 229 | 232 |
| 230 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 233 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |