| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/public/browser/render_widget_host.h" | 11 #include "content/public/browser/render_widget_host.h" |
| 12 #include "content/public/common/page_zoom.h" | 12 #include "content/public/common/page_zoom.h" |
| 13 #include "content/public/common/stop_find_action.h" | 13 #include "content/public/common/stop_find_action.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 15 | 15 |
| 16 class FilePath; | 16 class FilePath; |
| 17 class GURL; | 17 class GURL; |
| 18 struct WebDropData; | 18 struct WebDropData; |
| 19 struct WebPreferences; | 19 struct WebPreferences; |
| 20 | 20 |
| 21 namespace content { | |
| 22 class RenderViewHostDelegate; | |
| 23 class SessionStorageNamespace; | |
| 24 class SiteInstance; | |
| 25 struct CustomContextMenuContext; | |
| 26 } | |
| 27 | |
| 28 namespace gfx { | 21 namespace gfx { |
| 29 class Point; | 22 class Point; |
| 30 } | 23 } |
| 31 | 24 |
| 32 namespace WebKit { | 25 namespace WebKit { |
| 33 struct WebFindOptions; | 26 struct WebFindOptions; |
| 34 struct WebMediaPlayerAction; | 27 struct WebMediaPlayerAction; |
| 35 struct WebPluginAction; | 28 struct WebPluginAction; |
| 36 } | 29 } |
| 37 | 30 |
| 31 namespace content { |
| 32 |
| 33 class RenderViewHostDelegate; |
| 34 class SessionStorageNamespace; |
| 35 class SiteInstance; |
| 36 struct CustomContextMenuContext; |
| 37 |
| 38 // A RenderViewHost is responsible for creating and talking to a RenderView | 38 // A RenderViewHost is responsible for creating and talking to a RenderView |
| 39 // object in a child process. It exposes a high level API to users, for things | 39 // object in a child process. It exposes a high level API to users, for things |
| 40 // like loading pages, adjusting the display and other browser functionality, | 40 // like loading pages, adjusting the display and other browser functionality, |
| 41 // which it translates into IPC messages sent over the IPC channel with the | 41 // which it translates into IPC messages sent over the IPC channel with the |
| 42 // RenderView. It responds to all IPC messages sent by that RenderView and | 42 // RenderView. It responds to all IPC messages sent by that RenderView and |
| 43 // cracks them, calling a delegate object back with higher level types where | 43 // cracks them, calling a delegate object back with higher level types where |
| 44 // possible. | 44 // possible. |
| 45 // | 45 // |
| 46 // The intent of this interface is to provide a view-agnostic communication | 46 // The intent of this interface is to provide a view-agnostic communication |
| 47 // conduit with a renderer. This is so we can build HTML views not only as | 47 // conduit with a renderer. This is so we can build HTML views not only as |
| 48 // TabContents (see TabContents for an example) but also as views, etc. | 48 // TabContents (see TabContents for an example) but also as views, etc. |
| 49 // | |
| 50 // TODO(joi): Move to content namespace. | |
| 51 class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { | 49 class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { |
| 52 public: | 50 public: |
| 53 // Returns the RenderViewHost given its ID and the ID of its render process. | 51 // Returns the RenderViewHost given its ID and the ID of its render process. |
| 54 // Returns NULL if the IDs do not correspond to a live RenderViewHost. | 52 // Returns NULL if the IDs do not correspond to a live RenderViewHost. |
| 55 static RenderViewHost* FromID(int render_process_id, int render_view_id); | 53 static RenderViewHost* FromID(int render_process_id, int render_view_id); |
| 56 | 54 |
| 57 // Downcasts from a RenderWidgetHost to a RenderViewHost. Required | 55 // Downcasts from a RenderWidgetHost to a RenderViewHost. Required |
| 58 // because RenderWidgetHost is a virtual base class. | 56 // because RenderWidgetHost is a virtual base class. |
| 59 static RenderViewHost* From(RenderWidgetHost* rwh); | 57 static RenderViewHost* From(RenderWidgetHost* rwh); |
| 60 | 58 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 const gfx::Size& max_size) = 0; | 133 const gfx::Size& max_size) = 0; |
| 136 | 134 |
| 137 // Turns off auto-resize and gives a new size that the view should be. | 135 // Turns off auto-resize and gives a new size that the view should be. |
| 138 virtual void DisableAutoResize(const gfx::Size& new_size) = 0; | 136 virtual void DisableAutoResize(const gfx::Size& new_size) = 0; |
| 139 | 137 |
| 140 // Instructs the RenderView to send back updates to the preferred size. | 138 // Instructs the RenderView to send back updates to the preferred size. |
| 141 virtual void EnablePreferredSizeMode() = 0; | 139 virtual void EnablePreferredSizeMode() = 0; |
| 142 | 140 |
| 143 // Executes custom context menu action that was provided from WebKit. | 141 // Executes custom context menu action that was provided from WebKit. |
| 144 virtual void ExecuteCustomContextMenuCommand( | 142 virtual void ExecuteCustomContextMenuCommand( |
| 145 int action, const content::CustomContextMenuContext& context) = 0; | 143 int action, const CustomContextMenuContext& context) = 0; |
| 146 | 144 |
| 147 // Tells the renderer to perform the given action on the media player | 145 // Tells the renderer to perform the given action on the media player |
| 148 // located at the given point. | 146 // located at the given point. |
| 149 virtual void ExecuteMediaPlayerActionAtLocation( | 147 virtual void ExecuteMediaPlayerActionAtLocation( |
| 150 const gfx::Point& location, | 148 const gfx::Point& location, |
| 151 const WebKit::WebMediaPlayerAction& action) = 0; | 149 const WebKit::WebMediaPlayerAction& action) = 0; |
| 152 | 150 |
| 153 // Runs some javascript within the context of a frame in the page. | 151 // Runs some javascript within the context of a frame in the page. |
| 154 virtual void ExecuteJavascriptInWebFrame(const string16& frame_xpath, | 152 virtual void ExecuteJavascriptInWebFrame(const string16& frame_xpath, |
| 155 const string16& jscript) = 0; | 153 const string16& jscript) = 0; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 170 | 168 |
| 171 // Asks the renderer to exit fullscreen | 169 // Asks the renderer to exit fullscreen |
| 172 virtual void ExitFullscreen() = 0; | 170 virtual void ExitFullscreen() = 0; |
| 173 | 171 |
| 174 // Finds text on a page. | 172 // Finds text on a page. |
| 175 virtual void Find(int request_id, const string16& search_text, | 173 virtual void Find(int request_id, const string16& search_text, |
| 176 const WebKit::WebFindOptions& options) = 0; | 174 const WebKit::WebFindOptions& options) = 0; |
| 177 | 175 |
| 178 // Notifies the renderer that the user has closed the FindInPage window | 176 // Notifies the renderer that the user has closed the FindInPage window |
| 179 // (and what action to take regarding the selection). | 177 // (and what action to take regarding the selection). |
| 180 virtual void StopFinding(content::StopFindAction action) = 0; | 178 virtual void StopFinding(StopFindAction action) = 0; |
| 181 | 179 |
| 182 // Causes the renderer to invoke the onbeforeunload event handler. The | 180 // Causes the renderer to invoke the onbeforeunload event handler. The |
| 183 // result will be returned via ViewMsg_ShouldClose. See also ClosePage and | 181 // result will be returned via ViewMsg_ShouldClose. See also ClosePage and |
| 184 // SwapOut, which fire the PageUnload event. | 182 // SwapOut, which fire the PageUnload event. |
| 185 // | 183 // |
| 186 // Set bool for_cross_site_transition when this close is just for the current | 184 // Set bool for_cross_site_transition when this close is just for the current |
| 187 // RenderView in the case of a cross-site transition. False means we're | 185 // RenderView in the case of a cross-site transition. False means we're |
| 188 // closing the entire tab. | 186 // closing the entire tab. |
| 189 virtual void FirePageBeforeUnload(bool for_cross_site_transition) = 0; | 187 virtual void FirePageBeforeUnload(bool for_cross_site_transition) = 0; |
| 190 | 188 |
| 191 // Notifies the Listener that one or more files have been chosen by the user | 189 // Notifies the Listener that one or more files have been chosen by the user |
| 192 // from a file chooser dialog for the form. |permissions| are flags from the | 190 // from a file chooser dialog for the form. |permissions| are flags from the |
| 193 // base::PlatformFileFlags enum which specify which file permissions should | 191 // base::PlatformFileFlags enum which specify which file permissions should |
| 194 // be granted to the renderer. | 192 // be granted to the renderer. |
| 195 virtual void FilesSelectedInChooser(const std::vector<FilePath>& files, | 193 virtual void FilesSelectedInChooser(const std::vector<FilePath>& files, |
| 196 int permissions) = 0; | 194 int permissions) = 0; |
| 197 | 195 |
| 198 virtual content::RenderViewHostDelegate* GetDelegate() const = 0; | 196 virtual RenderViewHostDelegate* GetDelegate() const = 0; |
| 199 | 197 |
| 200 // Returns a bitwise OR of bindings types that have been enabled for this | 198 // Returns a bitwise OR of bindings types that have been enabled for this |
| 201 // RenderView. See BindingsPolicy for details. | 199 // RenderView. See BindingsPolicy for details. |
| 202 virtual int GetEnabledBindings() const = 0; | 200 virtual int GetEnabledBindings() const = 0; |
| 203 | 201 |
| 204 virtual content::SessionStorageNamespace* GetSessionStorageNamespace() = 0; | 202 virtual SessionStorageNamespace* GetSessionStorageNamespace() = 0; |
| 205 | 203 |
| 206 virtual content::SiteInstance* GetSiteInstance() const = 0; | 204 virtual SiteInstance* GetSiteInstance() const = 0; |
| 207 | 205 |
| 208 // Requests the renderer to evaluate an xpath to a frame and insert css | 206 // Requests the renderer to evaluate an xpath to a frame and insert css |
| 209 // into that frame's document. | 207 // into that frame's document. |
| 210 virtual void InsertCSS(const string16& frame_xpath, | 208 virtual void InsertCSS(const string16& frame_xpath, |
| 211 const std::string& css) = 0; | 209 const std::string& css) = 0; |
| 212 | 210 |
| 213 // Returns true if the RenderView is active and has not crashed. Virtual | 211 // Returns true if the RenderView is active and has not crashed. Virtual |
| 214 // because it is overridden by TestRenderViewHost. | 212 // because it is overridden by TestRenderViewHost. |
| 215 virtual bool IsRenderViewLive() const = 0; | 213 virtual bool IsRenderViewLive() const = 0; |
| 216 | 214 |
| 217 // Let the renderer know that the menu has been closed. | 215 // Let the renderer know that the menu has been closed. |
| 218 virtual void NotifyContextMenuClosed( | 216 virtual void NotifyContextMenuClosed( |
| 219 const content::CustomContextMenuContext& context) = 0; | 217 const CustomContextMenuContext& context) = 0; |
| 220 | 218 |
| 221 // Notification that a move or resize renderer's containing window has | 219 // Notification that a move or resize renderer's containing window has |
| 222 // started. | 220 // started. |
| 223 virtual void NotifyMoveOrResizeStarted() = 0; | 221 virtual void NotifyMoveOrResizeStarted() = 0; |
| 224 | 222 |
| 225 // Reloads the current focused frame. | 223 // Reloads the current focused frame. |
| 226 virtual void ReloadFrame() = 0; | 224 virtual void ReloadFrame() = 0; |
| 227 | 225 |
| 228 // Sets the alternate error page URL (link doctor) for the renderer process. | 226 // Sets the alternate error page URL (link doctor) for the renderer process. |
| 229 virtual void SetAltErrorPageURL(const GURL& url) = 0; | 227 virtual void SetAltErrorPageURL(const GURL& url) = 0; |
| 230 | 228 |
| 231 // Sets a property with the given name and value on the Web UI binding object. | 229 // Sets a property with the given name and value on the Web UI binding object. |
| 232 // Must call AllowWebUIBindings() on this renderer first. | 230 // Must call AllowWebUIBindings() on this renderer first. |
| 233 virtual void SetWebUIProperty(const std::string& name, | 231 virtual void SetWebUIProperty(const std::string& name, |
| 234 const std::string& value) = 0; | 232 const std::string& value) = 0; |
| 235 | 233 |
| 236 // Set the zoom level for the current main frame | 234 // Set the zoom level for the current main frame |
| 237 virtual void SetZoomLevel(double level) = 0; | 235 virtual void SetZoomLevel(double level) = 0; |
| 238 | 236 |
| 239 // Changes the zoom level for the current main frame. | 237 // Changes the zoom level for the current main frame. |
| 240 virtual void Zoom(content::PageZoom zoom) = 0; | 238 virtual void Zoom(PageZoom zoom) = 0; |
| 241 | 239 |
| 242 // Send the renderer process the current preferences supplied by the | 240 // Send the renderer process the current preferences supplied by the |
| 243 // RenderViewHostDelegate. | 241 // RenderViewHostDelegate. |
| 244 virtual void SyncRendererPrefs() = 0; | 242 virtual void SyncRendererPrefs() = 0; |
| 245 | 243 |
| 246 virtual void ToggleSpeechInput() = 0; | 244 virtual void ToggleSpeechInput() = 0; |
| 247 | 245 |
| 248 // Passes a list of Webkit preferences to the renderer. | 246 // Passes a list of Webkit preferences to the renderer. |
| 249 virtual void UpdateWebkitPreferences(const WebPreferences& prefs) = 0; | 247 virtual void UpdateWebkitPreferences(const WebPreferences& prefs) = 0; |
| 250 }; | 248 }; |
| 251 | 249 |
| 250 } // namespace content |
| 252 | 251 |
| 253 #endif // CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ | 252 #endif // CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ |
| OLD | NEW |