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 <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 bool did_stop_loading() const { return did_stop_loading_; } | 76 bool did_stop_loading() const { return did_stop_loading_; } |
77 bool document_element_available() const { | 77 bool document_element_available() const { |
78 return document_element_available_; | 78 return document_element_available_; |
79 } | 79 } |
80 | 80 |
81 Profile* profile() const { return profile_; } | 81 Profile* profile() const { return profile_; } |
82 | 82 |
83 ViewType::Type extension_host_type() const { return extension_host_type_; } | 83 ViewType::Type extension_host_type() const { return extension_host_type_; } |
84 | 84 |
85 // ExtensionFunctionDispatcher::Delegate | 85 // ExtensionFunctionDispatcher::Delegate |
86 virtual TabContents* associated_tab_contents() const { | 86 virtual TabContents* associated_tab_contents() const; |
87 return associated_tab_contents_; | |
88 } | |
89 void set_associated_tab_contents(TabContents* associated_tab_contents) { | 87 void set_associated_tab_contents(TabContents* associated_tab_contents) { |
90 associated_tab_contents_ = associated_tab_contents; | 88 associated_tab_contents_ = associated_tab_contents; |
91 } | 89 } |
92 | 90 |
93 // Returns true if the render view is initialized and didn't crash. | 91 // Returns true if the render view is initialized and didn't crash. |
94 bool IsRenderViewLive() const; | 92 bool IsRenderViewLive() const; |
95 | 93 |
96 // Prepares to initializes our RenderViewHost by creating its RenderView and | 94 // Prepares to initializes our RenderViewHost by creating its RenderView and |
97 // navigating to this host's url. Uses host_view for the RenderViewHost's view | 95 // navigating to this host's url. Uses host_view for the RenderViewHost's view |
98 // (can be NULL). This happens delayed to avoid locking the UI. | 96 // (can be NULL). This happens delayed to avoid locking the UI. |
99 void CreateRenderViewSoon(RenderWidgetHostView* host_view); | 97 void CreateRenderViewSoon(RenderWidgetHostView* host_view); |
100 | 98 |
101 // Sets |url_| and navigates |render_view_host_|. | 99 // Sets |url_| and navigates |render_view_host_|. |
102 void NavigateToURL(const GURL& url); | 100 void NavigateToURL(const GURL& url); |
103 | 101 |
104 // Insert a default style sheet for Extension Infobars. | 102 // Insert a default style sheet for Extension Infobars. |
105 void InsertInfobarCSS(); | 103 void InsertInfobarCSS(); |
106 | 104 |
107 // Tell the renderer not to draw scrollbars on windows smaller than | 105 // Tell the renderer not to draw scrollbars on windows smaller than |
108 // |size_limit| in both width and height. | 106 // |size_limit| in both width and height. |
109 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); | 107 void DisableScrollbarsForSmallWindows(const gfx::Size& size_limit); |
110 | 108 |
111 // RenderViewHostDelegate::View implementation. | 109 // RenderViewHostDelegate::View implementation. |
112 virtual const GURL& GetURL() const { return url_; } | 110 virtual const GURL& GetURL() const; |
113 virtual void RenderViewCreated(RenderViewHost* render_view_host); | 111 virtual void RenderViewCreated(RenderViewHost* render_view_host); |
114 virtual ViewType::Type GetRenderViewType() const; | 112 virtual ViewType::Type GetRenderViewType() const; |
115 virtual FileSelect* GetFileSelectDelegate(); | 113 virtual FileSelect* GetFileSelectDelegate(); |
116 virtual int GetBrowserWindowID() const; | 114 virtual int GetBrowserWindowID() const; |
117 virtual void RenderViewGone(RenderViewHost* render_view_host); | 115 virtual void RenderViewGone(RenderViewHost* render_view_host); |
118 virtual void DidNavigate(RenderViewHost* render_view_host, | 116 virtual void DidNavigate(RenderViewHost* render_view_host, |
119 const ViewHostMsg_FrameNavigate_Params& params); | 117 const ViewHostMsg_FrameNavigate_Params& params); |
120 virtual void DidStopLoading(); | 118 virtual void DidStopLoading(); |
121 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); | 119 virtual void DocumentAvailableInMainFrame(RenderViewHost* render_view_host); |
122 virtual void DocumentOnLoadCompletedInMainFrame( | 120 virtual void DocumentOnLoadCompletedInMainFrame( |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 virtual void Observe(NotificationType type, | 183 virtual void Observe(NotificationType type, |
186 const NotificationSource& source, | 184 const NotificationSource& source, |
187 const NotificationDetails& details); | 185 const NotificationDetails& details); |
188 | 186 |
189 // Overridden from JavaScriptAppModalDialogDelegate: | 187 // Overridden from JavaScriptAppModalDialogDelegate: |
190 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, | 188 virtual void OnMessageBoxClosed(IPC::Message* reply_msg, |
191 bool success, | 189 bool success, |
192 const std::wstring& prompt); | 190 const std::wstring& prompt); |
193 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {} | 191 virtual void SetSuppressMessageBoxes(bool suppress_message_boxes) {} |
194 virtual gfx::NativeWindow GetMessageBoxRootWindow(); | 192 virtual gfx::NativeWindow GetMessageBoxRootWindow(); |
195 virtual TabContents* AsTabContents() { return NULL; } | 193 virtual TabContents* AsTabContents(); |
196 virtual ExtensionHost* AsExtensionHost() { return this; } | 194 virtual ExtensionHost* AsExtensionHost(); |
197 | 195 |
198 protected: | 196 protected: |
199 // Internal functions used to support the CreateNewWidget() method. If a | 197 // Internal functions used to support the CreateNewWidget() method. If a |
200 // platform requires plugging into widget creation at a lower level, then a | 198 // platform requires plugging into widget creation at a lower level, then a |
201 // subclass might want to override these functions, but otherwise they should | 199 // subclass might want to override these functions, but otherwise they should |
202 // be fine just implementing RenderWidgetHostView::InitAsPopup(). | 200 // be fine just implementing RenderWidgetHostView::InitAsPopup(). |
203 // | 201 // |
204 // The Create function returns the newly created widget so it can be | 202 // The Create function returns the newly created widget so it can be |
205 // associated with the given route. When the widget needs to be shown later, | 203 // associated with the given route. When the widget needs to be shown later, |
206 // we'll look it up again and pass the object to the Show functions rather | 204 // we'll look it up again and pass the object to the Show functions rather |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // Used to measure how long it's been since the host was created. | 275 // Used to measure how long it's been since the host was created. |
278 PerfTimer since_created_; | 276 PerfTimer since_created_; |
279 | 277 |
280 // FileSelectHelper, lazily created. | 278 // FileSelectHelper, lazily created. |
281 scoped_ptr<FileSelectHelper> file_select_helper_; | 279 scoped_ptr<FileSelectHelper> file_select_helper_; |
282 | 280 |
283 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); | 281 DISALLOW_COPY_AND_ASSIGN(ExtensionHost); |
284 }; | 282 }; |
285 | 283 |
286 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ | 284 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_HOST_H_ |
OLD | NEW |