Chromium Code Reviews| 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 | 7 |
| 8 #include "base/values.h" | 8 #include "base/callback_forward.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
| 11 #include "content/public/common/page_zoom.h" | 11 #include "content/public/common/page_zoom.h" |
| 12 #include "content/public/common/stop_find_action.h" | 12 #include "content/public/common/stop_find_action.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
| 14 | 14 |
| 15 class FilePath; | 15 class FilePath; |
| 16 class GURL; | 16 class GURL; |
| 17 struct WebDropData; | 17 struct WebDropData; |
| 18 | 18 |
| 19 namespace webkit_glue { | |
| 20 struct WebPreferences; | |
| 21 } | |
| 22 | |
| 23 namespace gfx { | 19 namespace gfx { |
| 24 class Point; | 20 class Point; |
| 25 } | 21 } |
| 26 | 22 |
| 23 namespace base { | |
| 24 class Value; | |
| 25 } | |
| 26 | |
| 27 namespace ui { | 27 namespace ui { |
| 28 struct SelectedFileInfo; | 28 struct SelectedFileInfo; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace WebKit { | 31 namespace WebKit { |
| 32 struct WebFindOptions; | 32 struct WebFindOptions; |
| 33 struct WebMediaPlayerAction; | 33 struct WebMediaPlayerAction; |
| 34 struct WebPluginAction; | 34 struct WebPluginAction; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace webkit_glue { | |
| 38 struct WebPreferences; | |
| 39 } | |
| 40 | |
| 37 namespace content { | 41 namespace content { |
| 38 | 42 |
| 39 class ChildProcessSecurityPolicy; | 43 class ChildProcessSecurityPolicy; |
| 40 class RenderProcessHost; | 44 class RenderProcessHost; |
| 41 class RenderViewHostDelegate; | 45 class RenderViewHostDelegate; |
| 42 class SessionStorageNamespace; | 46 class SessionStorageNamespace; |
| 43 class SiteInstance; | 47 class SiteInstance; |
| 44 struct CustomContextMenuContext; | 48 struct CustomContextMenuContext; |
| 45 | 49 |
| 46 // A RenderViewHost is responsible for creating and talking to a RenderView | 50 // A RenderViewHost is responsible for creating and talking to a RenderView |
| 47 // object in a child process. It exposes a high level API to users, for things | 51 // object in a child process. It exposes a high level API to users, for things |
| 48 // like loading pages, adjusting the display and other browser functionality, | 52 // like loading pages, adjusting the display and other browser functionality, |
| 49 // which it translates into IPC messages sent over the IPC channel with the | 53 // which it translates into IPC messages sent over the IPC channel with the |
| 50 // RenderView. It responds to all IPC messages sent by that RenderView and | 54 // RenderView. It responds to all IPC messages sent by that RenderView and |
| 51 // cracks them, calling a delegate object back with higher level types where | 55 // cracks them, calling a delegate object back with higher level types where |
| 52 // possible. | 56 // possible. |
| 53 // | 57 // |
| 54 // The intent of this interface is to provide a view-agnostic communication | 58 // The intent of this interface is to provide a view-agnostic communication |
| 55 // conduit with a renderer. This is so we can build HTML views not only as | 59 // conduit with a renderer. This is so we can build HTML views not only as |
| 56 // WebContents (see WebContents for an example) but also as views, etc. | 60 // WebContents (see WebContents for an example) but also as views, etc. |
| 57 class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { | 61 class CONTENT_EXPORT RenderViewHost : virtual public RenderWidgetHost { |
| 58 public: | 62 public: |
| 63 typedef base::Callback<void(const base::Value*)> JavascriptResultCallback; | |
| 64 | |
| 59 // Returns the RenderViewHost given its ID and the ID of its render process. | 65 // Returns the RenderViewHost given its ID and the ID of its render process. |
| 60 // Returns NULL if the IDs do not correspond to a live RenderViewHost. | 66 // Returns NULL if the IDs do not correspond to a live RenderViewHost. |
| 61 static RenderViewHost* FromID(int render_process_id, int render_view_id); | 67 static RenderViewHost* FromID(int render_process_id, int render_view_id); |
| 62 | 68 |
| 63 // Downcasts from a RenderWidgetHost to a RenderViewHost. Required | 69 // Downcasts from a RenderWidgetHost to a RenderViewHost. Required |
| 64 // because RenderWidgetHost is a virtual base class. | 70 // because RenderWidgetHost is a virtual base class. |
| 65 static RenderViewHost* From(RenderWidgetHost* rwh); | 71 static RenderViewHost* From(RenderWidgetHost* rwh); |
| 66 | 72 |
| 67 // Checks that the given renderer can request |url|, if not it sets it to | 73 // Checks that the given renderer can request |url|, if not it sets it to |
| 68 // about:blank. | 74 // about:blank. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 // located at the given point. | 170 // located at the given point. |
| 165 virtual void ExecuteMediaPlayerActionAtLocation( | 171 virtual void ExecuteMediaPlayerActionAtLocation( |
| 166 const gfx::Point& location, | 172 const gfx::Point& location, |
| 167 const WebKit::WebMediaPlayerAction& action) = 0; | 173 const WebKit::WebMediaPlayerAction& action) = 0; |
| 168 | 174 |
| 169 // Runs some javascript within the context of a frame in the page. | 175 // Runs some javascript within the context of a frame in the page. |
| 170 virtual void ExecuteJavascriptInWebFrame(const string16& frame_xpath, | 176 virtual void ExecuteJavascriptInWebFrame(const string16& frame_xpath, |
| 171 const string16& jscript) = 0; | 177 const string16& jscript) = 0; |
| 172 | 178 |
| 173 // Runs some javascript within the context of a frame in the page. The result | 179 // Runs some javascript within the context of a frame in the page. The result |
| 174 // is sent back via the notification EXECUTE_JAVASCRIPT_RESULT. | 180 // is sent back via the notification NOTIFICATION_EXECUTE_JAVASCRIPT_RESULT. |
| 181 // This returns an int, used as a key to identify the corresponding | |
| 182 // notification. | |
| 183 // OBSOLETE. Use ExecuteJavascriptInWebFrameCallbackResult instead. | |
| 175 virtual int ExecuteJavascriptInWebFrameNotifyResult( | 184 virtual int ExecuteJavascriptInWebFrameNotifyResult( |
|
jam
2013/01/03 20:53:02
what's the plan for removing this? i.e. will it be
Avi (use Gerrit)
2013/01/03 21:01:53
Both will be done in followups. I'm working on bot
| |
| 176 const string16& frame_xpath, | 185 const string16& frame_xpath, |
| 177 const string16& jscript) = 0; | 186 const string16& jscript) = 0; |
| 178 | 187 |
| 179 virtual Value* ExecuteJavascriptAndGetValue(const string16& frame_xpath, | 188 // Runs some javascript within the context of a frame in the page. The result |
| 180 const string16& jscript) = 0; | 189 // is sent back via the provided callback. |
| 190 virtual void ExecuteJavascriptInWebFrameCallbackResult( | |
| 191 const string16& frame_xpath, | |
| 192 const string16& jscript, | |
| 193 const JavascriptResultCallback& callback) = 0; | |
| 194 | |
| 195 // Runs some javascript within the context of a frame in the page. A nested | |
| 196 // message loop is run to wait for the result, which is returned. THIS SHOULD | |
| 197 // ONLY BE USED BY TESTS. TODO(avi): Move into a test file. | |
| 198 virtual base::Value* ExecuteJavascriptAndGetValue( | |
| 199 const string16& frame_xpath, | |
| 200 const string16& jscript) = 0; | |
| 181 | 201 |
| 182 // Tells the renderer to perform the given action on the plugin located at | 202 // Tells the renderer to perform the given action on the plugin located at |
| 183 // the given point. | 203 // the given point. |
| 184 virtual void ExecutePluginActionAtLocation( | 204 virtual void ExecutePluginActionAtLocation( |
| 185 const gfx::Point& location, const WebKit::WebPluginAction& action) = 0; | 205 const gfx::Point& location, const WebKit::WebPluginAction& action) = 0; |
| 186 | 206 |
| 187 // Asks the renderer to exit fullscreen | 207 // Asks the renderer to exit fullscreen |
| 188 virtual void ExitFullscreen() = 0; | 208 virtual void ExitFullscreen() = 0; |
| 189 | 209 |
| 190 // Finds text on a page. | 210 // Finds text on a page. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 const WebKit::WebFindOptions& options, | 305 const WebKit::WebFindOptions& options, |
| 286 int* match_count, | 306 int* match_count, |
| 287 int* active_ordinal) = 0; | 307 int* active_ordinal) = 0; |
| 288 #endif | 308 #endif |
| 289 | 309 |
| 290 }; | 310 }; |
| 291 | 311 |
| 292 } // namespace content | 312 } // namespace content |
| 293 | 313 |
| 294 #endif // CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ | 314 #endif // CONTENT_PUBLIC_BROWSER_RENDER_VIEW_HOST_H_ |
| OLD | NEW |