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

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

Issue 11778034: Revert 175489 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 175490)
+++ content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java (working copy)
@@ -18,7 +18,6 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
-import android.os.Message;
import android.os.ResultReceiver;
import android.text.Editable;
import android.util.Log;
@@ -1050,19 +1049,17 @@
}
/**
- * Injects the passed Javascript code in the current page and evaluates it.
- * If a result is required, pass in a Message to be sent to its target.
- * 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 message to be fired off when a result is ready. The script's
- * result will be json encoded in the Message's {@link Message#obj} field.
- * 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, Message message) throws IllegalStateException {
+ public int evaluateJavaScript(String script) throws IllegalStateException {
checkIsAlive();
- nativeEvaluateJavaScript(mNativeContentViewCore, script, message);
+ return nativeEvaluateJavaScript(script);
}
/**
@@ -1993,9 +1990,8 @@
@SuppressWarnings("unused")
@CalledByNative
- private static void onEvaluateJavaScriptResult(String jsonResult, Message message) {
- message.obj = jsonResult;
- message.sendToTarget();
+ private void onEvaluateJavaScriptResult(int id, String jsonResult) {
+ getContentViewClient().onEvaluateJavaScriptResult(id, jsonResult);
}
@SuppressWarnings("unused")
@@ -2506,8 +2502,7 @@
private native void nativeClearHistory(int nativeContentViewCoreImpl);
- private native void nativeEvaluateJavaScript(int nativeContentViewCoreImpl,
- String script, Message message);
+ private native int nativeEvaluateJavaScript(String script);
private native int nativeGetNativeImeAdapter(int nativeContentViewCoreImpl);

Powered by Google App Engine
This is Rietveld 408576698