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

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: 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
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..3856c65fd9611a194008a70b1ee95e2509d35911 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")
Ted C 2012/07/31 18:15:48 if this is non-private, I don't think you need the
David Trainor- moved to gerrit 2012/07/31 20:38:47 Made it private.
+ @CalledByNative
+ 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);
« content/browser/android/content_view_core_impl.cc ('K') | « content/content_shell.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698