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> |
11 | 11 |
12 #include "base/perftimer.h" | 12 #include "base/perftimer.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 14 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
15 #include "chrome/browser/jsmessage_box_client.h" | 15 #include "chrome/browser/jsmessage_box_client.h" |
16 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 16 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
17 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" | 17 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
18 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
19 #include "chrome/browser/views/extensions/extension_view.h" | 19 #include "chrome/browser/views/extensions/extension_view.h" |
20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
21 #include "chrome/browser/cocoa/extension_view_mac.h" | 21 #include "chrome/browser/cocoa/extension_view_mac.h" |
22 #elif defined(TOOLKIT_GTK) | 22 #elif defined(TOOLKIT_GTK) |
23 #include "chrome/browser/gtk/extension_view_gtk.h" | 23 #include "chrome/browser/gtk/extension_view_gtk.h" |
24 #endif | 24 #endif |
25 #include "chrome/common/notification_registrar.h" | 25 #include "chrome/common/notification_registrar.h" |
26 | 26 |
27 class Browser; | 27 class Browser; |
28 class Extension; | 28 class Extension; |
| 29 class FileSelectHelper; |
29 class RenderProcessHost; | 30 class RenderProcessHost; |
30 class RenderWidgetHostView; | 31 class RenderWidgetHostView; |
31 class TabContents; | 32 class TabContents; |
32 struct WebPreferences; | 33 struct WebPreferences; |
33 | 34 |
34 // This class is the browser component of an extension component's RenderView. | 35 // This class is the browser component of an extension component's RenderView. |
35 // It handles setting up the renderer process, if needed, with special | 36 // It handles setting up the renderer process, if needed, with special |
36 // privileges available to extensions. It may have a view to be shown in the | 37 // privileges available to extensions. It may have a view to be shown in the |
37 // in the browser UI, or it may be hidden. | 38 // in the browser UI, or it may be hidden. |
38 class ExtensionHost : public RenderViewHostDelegate, | 39 class ExtensionHost : public RenderViewHostDelegate, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 109 |
109 // Tell the renderer not to draw scrollbars on windows smaller than | 110 // Tell the renderer not to draw scrollbars on windows smaller than |
110 // |size_limit| in both width and height. | 111 // |size_limit| in both width and height. |
111 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); | 112 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); |
112 | 113 |
113 // RenderViewHostDelegate implementation. | 114 // RenderViewHostDelegate implementation. |
114 virtual RenderViewHostDelegate::View* GetViewDelegate(); | 115 virtual RenderViewHostDelegate::View* GetViewDelegate(); |
115 virtual const GURL& GetURL() const { return url_; } | 116 virtual const GURL& GetURL() const { return url_; } |
116 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 117 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
117 virtual ViewType::Type GetRenderViewType() const; | 118 virtual ViewType::Type GetRenderViewType() const; |
| 119 virtual FileSelect* GetFileSelectDelegate(); |
118 virtual int GetBrowserWindowID() const; | 120 virtual int GetBrowserWindowID() const; |
119 virtual void RenderViewGone(RenderViewHost* render_view_host); | 121 virtual void RenderViewGone(RenderViewHost* render_view_host); |
120 virtual void DidNavigate(RenderViewHost* render_view_host, | 122 virtual void DidNavigate(RenderViewHost* render_view_host, |
121 const ViewHostMsg_FrameNavigate_Params& params); | 123 const ViewHostMsg_FrameNavigate_Params& params); |
122 virtual void DidStopLoading(); | 124 virtual void DidStopLoading(); |
123 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); | 125 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); |
124 virtual void DocumentOnLoadCompletedInMainFrame( | 126 virtual void DocumentOnLoadCompletedInMainFrame( |
125 RenderViewHost* render_view_host); | 127 RenderViewHost* render_view_host); |
126 | 128 |
127 virtual WebPreferences GetWebkitPrefs(); | 129 virtual WebPreferences GetWebkitPrefs(); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // Only EXTENSION_INFOBAR, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE | 263 // Only EXTENSION_INFOBAR, EXTENSION_POPUP, and EXTENSION_BACKGROUND_PAGE |
262 // are used here, others are not hosted by ExtensionHost. | 264 // are used here, others are not hosted by ExtensionHost. |
263 ViewType::Type extension_host_type_; | 265 ViewType::Type extension_host_type_; |
264 | 266 |
265 // The relevant TabContents associated with this ExtensionHost, if any. | 267 // The relevant TabContents associated with this ExtensionHost, if any. |
266 TabContents* associated_tab_contents_; | 268 TabContents* associated_tab_contents_; |
267 | 269 |
268 // Used to measure how long it's been since the host was created. | 270 // Used to measure how long it's been since the host was created. |
269 PerfTimer since_created_; | 271 PerfTimer since_created_; |
270 | 272 |
| 273 // FileSelectHelper, lazily created. |
| 274 scoped_ptr<FileSelectHelper> file_select_helper_; |
| 275 |
271 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 276 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
272 }; | 277 }; |
273 | 278 |
274 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 279 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |