| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <list> | 10 #include <list> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ViewType::Type extension_host_type() const { return extension_host_type_; } | 85 ViewType::Type extension_host_type() const { return extension_host_type_; } |
| 86 | 86 |
| 87 // ExtensionFunctionDispatcher::Delegate | 87 // ExtensionFunctionDispatcher::Delegate |
| 88 virtual TabContents* associated_tab_contents() { | 88 virtual TabContents* associated_tab_contents() { |
| 89 return associated_tab_contents_; | 89 return associated_tab_contents_; |
| 90 } | 90 } |
| 91 void set_associated_tab_contents(TabContents* associated_tab_contents) { | 91 void set_associated_tab_contents(TabContents* associated_tab_contents) { |
| 92 associated_tab_contents_ = associated_tab_contents; | 92 associated_tab_contents_ = associated_tab_contents; |
| 93 } | 93 } |
| 94 | 94 |
| 95 // Sets the the ViewType of this host (e.g. mole, toolstrip). | |
| 96 void SetRenderViewType(ViewType::Type type); | |
| 97 | |
| 98 // Returns true if the render view is initialized and didn't crash. | 95 // Returns true if the render view is initialized and didn't crash. |
| 99 bool IsRenderViewLive() const; | 96 bool IsRenderViewLive() const; |
| 100 | 97 |
| 101 // Prepares to initializes our RenderViewHost by creating its RenderView and | 98 // Prepares to initializes our RenderViewHost by creating its RenderView and |
| 102 // navigating to this host's url. Uses host_view for the RenderViewHost's view | 99 // navigating to this host's url. Uses host_view for the RenderViewHost's view |
| 103 // (can be NULL). This happens delayed to avoid locking the UI. | 100 // (can be NULL). This happens delayed to avoid locking the UI. |
| 104 void CreateRenderViewSoon(RenderWidgetHostView* host_view); | 101 void CreateRenderViewSoon(RenderWidgetHostView* host_view); |
| 105 | 102 |
| 106 // Sets |url_| and navigates |render_view_host_|. | 103 // Sets |url_| and navigates |render_view_host_|. |
| 107 void NavigateToURL(const GURL& url); | 104 void NavigateToURL(const GURL& url); |
| 108 | 105 |
| 109 // Insert a default style sheet for Extension Infobars. | 106 // Insert a default style sheet for Extension Infobars. |
| 110 void InsertInfobarCSS(); | 107 void InsertInfobarCSS(); |
| 111 | 108 |
| 112 // Insert the theme CSS for a toolstrip/mole. | |
| 113 void InsertThemedToolstripCSS(); | |
| 114 | |
| 115 // Tell the renderer not to draw scrollbars on windows smaller than | 109 // Tell the renderer not to draw scrollbars on windows smaller than |
| 116 // |size_limit| in both width and height. | 110 // |size_limit| in both width and height. |
| 117 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); | 111 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); |
| 118 | 112 |
| 119 // RenderViewHostDelegate implementation. | 113 // RenderViewHostDelegate implementation. |
| 120 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 114 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
| 121 virtual const GURL& GetURL() const { return url_; } | 115 virtual const GURL& GetURL() const { return url_; } |
| 122 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 116 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
| 123 virtual ViewType::Type GetRenderViewType() const; | 117 virtual ViewType::Type GetRenderViewType() const; |
| 124 virtual int GetBrowserWindowID() const; | 118 virtual int GetBrowserWindowID() const; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // True if the main frame has finished parsing. | 254 // True if the main frame has finished parsing. |
| 261 bool document_element_available_; | 255 bool document_element_available_; |
| 262 | 256 |
| 263 // The URL being hosted. | 257 // The URL being hosted. |
| 264 GURL url_; | 258 GURL url_; |
| 265 | 259 |
| 266 NotificationRegistrar registrar_; | 260 NotificationRegistrar registrar_; |
| 267 | 261 |
| 268 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 262 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 269 | 263 |
| 270 // Only EXTENSION_TOOLSTRIP, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE | 264 // Only EXTENSION_INFOBAR, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE |
| 271 // are used here, others are not hosted by ExtensionHost. | 265 // are used here, others are not hosted by ExtensionHost. |
| 272 ViewType::Type extension_host_type_; | 266 ViewType::Type extension_host_type_; |
| 273 | 267 |
| 274 // The relevant TabContents associated with this ExtensionHost, if any. | 268 // The relevant TabContents associated with this ExtensionHost, if any. |
| 275 TabContents* associated_tab_contents_; | 269 TabContents* associated_tab_contents_; |
| 276 | 270 |
| 277 // Used to measure how long it's been since the host was created. | 271 // Used to measure how long it's been since the host was created. |
| 278 PerfTimer since_created_; | 272 PerfTimer since_created_; |
| 279 | 273 |
| 280 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 274 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
| 281 }; | 275 }; |
| 282 | 276 |
| 283 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 277 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
| OLD | NEW |