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 7a4c05e963061f7c0e5e18756dbdf72d558d39f8..f826a93c030f34b79fca1d67a04f434a0cf3497f 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 |
@@ -18,6 +18,7 @@ import android.graphics.Rect; |
import android.os.Build; |
import android.os.Bundle; |
import android.os.Handler; |
+import android.os.Message; |
import android.os.ResultReceiver; |
import android.os.SystemClock; |
import android.text.Editable; |
@@ -1045,17 +1046,19 @@ 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. |
+ * 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. |
* |
- * @return an id that is passed along in the asynchronous onJavaScriptEvaluationResult callback |
+ * @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. |
* @throws IllegalStateException If the ContentView has been destroyed. |
*/ |
- public int evaluateJavaScript(String script) throws IllegalStateException { |
+ public void evaluateJavaScript(String script, Message message) throws IllegalStateException { |
checkIsAlive(); |
- return nativeEvaluateJavaScript(script); |
+ nativeEvaluateJavaScript(script, message); |
} |
/** |
@@ -1986,8 +1989,9 @@ public class ContentViewCore implements MotionEventDelegate { |
@SuppressWarnings("unused") |
@CalledByNative |
- private void onEvaluateJavaScriptResult(int id, String jsonResult) { |
- getContentViewClient().onEvaluateJavaScriptResult(id, jsonResult); |
+ private void onEvaluateJavaScriptResult(String jsonResult, Message message) { |
joth
2013/01/05 00:54:42
declare this as static, and then you can skip reso
|
+ message.obj = jsonResult; |
+ message.sendToTarget(); |
} |
@SuppressWarnings("unused") |
@@ -2494,7 +2498,7 @@ public class ContentViewCore implements MotionEventDelegate { |
private native void nativeClearHistory(int nativeContentViewCoreImpl); |
- private native int nativeEvaluateJavaScript(String script); |
+ private native void nativeEvaluateJavaScript(String script, Message message); |
joth
2013/01/05 00:54:42
huh. I think this was pretty old code :)
If you p
Avi (use Gerrit)
2013/01/05 01:05:48
That was the last user of ContentViewCore::GetNati
|
private native int nativeGetNativeImeAdapter(int nativeContentViewCoreImpl); |