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 "chrome/browser/renderer_host/render_view_host_delegate.h" | 8 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
9 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 9 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
10 | 10 |
11 class Browser; | 11 class Browser; |
12 class Extension; | 12 class Extension; |
13 class ExtensionView; | 13 class ExtensionView; |
14 class RenderWidgetHost; | 14 class RenderWidgetHost; |
15 class RenderWidgetHostView; | 15 class RenderWidgetHostView; |
16 class TabContents; | 16 class TabContents; |
17 struct WebPreferences; | 17 struct WebPreferences; |
18 | 18 |
19 // This class is the browser component of an extension component's RenderView. | 19 // This class is the browser component of an extension component's RenderView. |
20 // It handles setting up the renderer process, if needed, with special | 20 // It handles setting up the renderer process, if needed, with special |
21 // privileges available to extensions. It may have a view to be shown in the | 21 // privileges available to extensions. It may have a view to be shown in the |
22 // in the browser UI, or it may be hidden. | 22 // in the browser UI, or it may be hidden. |
23 class ExtensionHost : public RenderViewHostDelegate, | 23 class ExtensionHost : public RenderViewHostDelegate, |
24 public RenderViewHostDelegate::View, | 24 public RenderViewHostDelegate::View, |
25 public ExtensionFunctionDispatcher::Delegate { | 25 public ExtensionFunctionDispatcher::Delegate { |
26 public: | 26 public: |
27 ExtensionHost(Extension* extension, SiteInstance* site_instance); | 27 ExtensionHost(Extension* extension, SiteInstance* site_instance); |
28 ~ExtensionHost(); | 28 ~ExtensionHost(); |
29 | 29 |
| 30 #if defined(OS_WIN) |
30 void set_view(ExtensionView* view) { view_ = view; } | 31 void set_view(ExtensionView* view) { view_ = view; } |
31 ExtensionView* view() const { return view_; } | 32 ExtensionView* view() const { return view_; } |
| 33 #endif |
32 Extension* extension() { return extension_; } | 34 Extension* extension() { return extension_; } |
33 RenderViewHost* render_view_host() const { return render_view_host_; } | 35 RenderViewHost* render_view_host() const { return render_view_host_; } |
34 SiteInstance* site_instance() const; | 36 SiteInstance* site_instance() const; |
35 bool did_stop_loading() const { return did_stop_loading_; } | 37 bool did_stop_loading() const { return did_stop_loading_; } |
36 | 38 |
37 // Initializes our RenderViewHost by creating its RenderView and navigating | 39 // Initializes our RenderViewHost by creating its RenderView and navigating |
38 // to the given URL. Uses host_view for the RenderViewHost's view (can be | 40 // to the given URL. Uses host_view for the RenderViewHost's view (can be |
39 // NULL). | 41 // NULL). |
40 void CreateRenderView(const GURL& url, RenderWidgetHostView* host_view); | 42 void CreateRenderView(const GURL& url, RenderWidgetHostView* host_view); |
41 | 43 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 private: | 79 private: |
78 // ExtensionFunctionDispatcher::Delegate | 80 // ExtensionFunctionDispatcher::Delegate |
79 // If this ExtensionHost has a view, this returns the Browser that view is a | 81 // If this ExtensionHost has a view, this returns the Browser that view is a |
80 // part of. If this is a global background page, we use the active Browser | 82 // part of. If this is a global background page, we use the active Browser |
81 // instead. | 83 // instead. |
82 virtual Browser* GetBrowser(); | 84 virtual Browser* GetBrowser(); |
83 | 85 |
84 // The extension that we're hosting in this view. | 86 // The extension that we're hosting in this view. |
85 Extension* extension_; | 87 Extension* extension_; |
86 | 88 |
| 89 #if defined(OS_WIN) |
87 // Optional view that shows the rendered content in the UI. | 90 // Optional view that shows the rendered content in the UI. |
88 ExtensionView* view_; | 91 ExtensionView* view_; |
| 92 #endif |
89 | 93 |
90 // The host for our HTML content. | 94 // The host for our HTML content. |
91 RenderViewHost* render_view_host_; | 95 RenderViewHost* render_view_host_; |
92 | 96 |
93 // Common implementations of some RenderViewHostDelegate::View methods. | 97 // Common implementations of some RenderViewHostDelegate::View methods. |
94 RenderViewHostDelegateViewHelper delegate_view_helper_; | 98 RenderViewHostDelegateViewHelper delegate_view_helper_; |
95 | 99 |
96 // Whether the RenderWidget has reported that it has stopped loading. | 100 // Whether the RenderWidget has reported that it has stopped loading. |
97 bool did_stop_loading_; | 101 bool did_stop_loading_; |
98 | 102 |
99 // The URL being hosted. | 103 // The URL being hosted. |
100 GURL url_; | 104 GURL url_; |
101 | 105 |
102 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 106 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
103 }; | 107 }; |
104 | 108 |
105 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 109 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |