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

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

Issue 11883037: Revert 176773 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1384/src/
Patch Set: Created 7 years, 11 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
===================================================================
--- content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java (revision 176919)
+++ content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java (working copy)
@@ -1097,26 +1097,18 @@
}
}
- public interface JavaScriptCallback {
- void handleJavaScriptResult(String jsonResult);
- }
-
/**
- * Injects the passed Javascript code in the current page and evaluates it.
- * If a result is required, pass in a callback.
- * Used in automation tests.
+ * 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.
*
- * @param script The Javascript to execute.
- * @param message The callback to be fired off when a result is ready. The script's
- * result will be json encoded and passed as the parameter, and the call
- * will be made on the main thread.
- * If no result is required, pass null.
+ * @return an id that is passed along in the asynchronous onJavaScriptEvaluationResult callback
* @throws IllegalStateException If the ContentView has been destroyed.
*/
- public void evaluateJavaScript(
- String script, JavaScriptCallback callback) throws IllegalStateException {
+ public int evaluateJavaScript(String script) throws IllegalStateException {
checkIsAlive();
- nativeEvaluateJavaScript(mNativeContentViewCore, script, callback);
+ return nativeEvaluateJavaScript(script);
}
/**
@@ -2051,9 +2043,8 @@
@SuppressWarnings("unused")
@CalledByNative
- private static void onEvaluateJavaScriptResult(
- String jsonResult, JavaScriptCallback callback) {
- callback.handleJavaScriptResult(jsonResult);
+ private void onEvaluateJavaScriptResult(int id, String jsonResult) {
+ getContentViewClient().onEvaluateJavaScriptResult(id, jsonResult);
}
@SuppressWarnings("unused")
@@ -2564,8 +2555,7 @@
private native void nativeClearHistory(int nativeContentViewCoreImpl);
- private native void nativeEvaluateJavaScript(int nativeContentViewCoreImpl,
- String script, JavaScriptCallback callback);
+ private native int nativeEvaluateJavaScript(String script);
private native int nativeGetNativeImeAdapter(int nativeContentViewCoreImpl);

Powered by Google App Engine
This is Rietveld 408576698