Index: content/public/browser/render_frame_host.h |
diff --git a/content/public/browser/render_frame_host.h b/content/public/browser/render_frame_host.h |
index 3097ff11616af0f9efcc8b5401c0f1d624d3d948..e47441df9aebe577a4ae10dbc6e3e0dbf606797c 100644 |
--- a/content/public/browser/render_frame_host.h |
+++ b/content/public/browser/render_frame_host.h |
@@ -35,6 +35,11 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, |
// Returns nullptr if the IDs do not correspond to a live RenderFrameHost. |
static RenderFrameHost* FromID(int render_process_id, int render_frame_id); |
+ // Globally allows for injecting JavaScript into the main world. This feature |
+ // is present only to support Android WebView and must not be used in other |
+ // configurations. |
+ static void AllowInjectingJavaScriptForAndroidWebView(); |
+ |
~RenderFrameHost() override {} |
// Returns the route id for this frame. |
@@ -74,17 +79,24 @@ class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, |
// Runs some JavaScript in this frame's context. If a callback is provided, it |
// will be used to return the result, when the result is available. |
+ // This API can only be called on chrome:// or chrome-devtools:// URLs. |
typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; |
virtual void ExecuteJavaScript(const base::string16& javascript) = 0; |
virtual void ExecuteJavaScript(const base::string16& javascript, |
const JavaScriptResultCallback& callback) = 0; |
+ |
+ // Runs some JavaScript in an isolated world of top of this frame's context. |
virtual void ExecuteJavaScriptInIsolatedWorld( |
const base::string16& javascript, |
const JavaScriptResultCallback& callback, |
int world_id) = 0; |
- // ONLY FOR TESTS: Same as above but adds a fake UserGestureIndicator around |
- // execution. (crbug.com/408426) |
+ // ONLY FOR TESTS: Same as above but without restrictions. Optionally, adds a |
+ // fake UserGestureIndicator around execution. (crbug.com/408426) |
+ virtual void ExecuteJavaScriptForTests(const base::string16& javascript) = 0; |
+ virtual void ExecuteJavaScriptForTests( |
+ const base::string16& javascript, |
+ const JavaScriptResultCallback& callback) = 0; |
virtual void ExecuteJavaScriptWithUserGestureForTests( |
const base::string16& javascript) = 0; |