Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2033)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 10848002: Upstream evaluateJavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Fixes Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_shell.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index d97b6d13cd24cd7c7657277d7785e88a1596f4c2..d9db6cdd400e7143929b136cd4c4de90b34a1a2a 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -563,6 +563,21 @@ public class ContentViewCore implements MotionEventDelegate {
}
/**
+ * Injects the passed JavaScript code in the current page and evaluates it.
+ * Once evaluated, an asynchronous call to
+ * ContentViewClient.onJavaScriptEvaluationResult is made. Used in automation
+ * tests.
+ *
+ * @return an id that is passed along in the asynchronous onJavaScriptEvaluationResult callback
+ * @throws IllegalStateException If the ContentView has been destroyed.
+ * @hide
+ */
+ public int evaluateJavaScript(String script) throws IllegalStateException {
+ checkIsAlive();
+ return nativeEvaluateJavaScript(script);
+ }
+
+ /**
* This method should be called when the containing activity is paused
*/
public void onActivityPause() {
@@ -738,6 +753,12 @@ public class ContentViewCore implements MotionEventDelegate {
SelectPopupDialog.show(this, items, enabled, multiple, selectedIndices);
}
+ @SuppressWarnings("unused")
+ @CalledByNative
+ private void onEvaluateJavaScriptResult(int id, String jsonResult) {
+ getContentViewClient().onEvaluateJavaScriptResult(id, jsonResult);
+ }
+
/**
* Called (from native) when page loading begins.
*/
@@ -997,6 +1018,8 @@ public class ContentViewCore implements MotionEventDelegate {
private native void nativeClearHistory(int nativeContentViewCoreImpl);
+ private native int nativeEvaluateJavaScript(String script);
+
private native void nativeAddJavascriptInterface(int nativeContentViewCoreImpl, Object object,
String name, boolean allowInheritedMethods);
« no previous file with comments | « content/content_shell.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698