Chromium Code Reviews| 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 cf404ccede7786d7b841e99bbf716a4cc07ae6d7..25169c86dfc2449adb00e636fb54c9019f765ce9 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 |
| @@ -45,6 +45,7 @@ import android.view.accessibility.AccessibilityNodeProvider; |
| import android.view.inputmethod.EditorInfo; |
| import android.view.inputmethod.InputConnection; |
| import android.view.inputmethod.InputMethodManager; |
| +import android.webkit.ValueCallback; |
| import android.widget.FrameLayout; |
| import com.google.common.annotations.VisibleForTesting; |
| @@ -1396,6 +1397,16 @@ public class ContentViewCore |
| } |
| /** |
| + * Creates a message channel. |
| + * |
| + * @param callback The message channel created or null if some error occurred. |
| + */ |
| + public void createMessageChannel(ValueCallback<MessageChannel> callback) { |
|
Yaron
2014/07/18 21:54:00
Please add a test for this API
sgurun-gerrit only
2014/10/28 00:41:11
Done.
|
| + if (mNativeContentViewCore == 0) return; |
| + nativeCreateMessageChannel(mNativeContentViewCore, callback); |
| + } |
| + |
| + /** |
| * To be called when the ContentView is shown. |
| */ |
| public void onShow() { |
| @@ -2558,6 +2569,12 @@ public class ContentViewCore |
| attachImeAdapter(); |
| } |
| + @CalledByNative |
| + private static void onMessageChannelCreated(int portId1, int portId2, |
| + ValueCallback<MessageChannel> callback) { |
| + callback.onReceiveValue(new MessageChannel(portId1, portId2)); |
| + } |
| + |
| /** |
| * Attaches the native ImeAdapter object to the java ImeAdapter to allow communication via JNI. |
| */ |
| @@ -3303,6 +3320,9 @@ public class ContentViewCore |
| private native void nativeEvaluateJavaScript(long nativeContentViewCoreImpl, |
| String script, JavaScriptCallback callback, boolean startRenderer); |
| + private native void nativeCreateMessageChannel(long nativeContentViewCoreImpl, |
| + ValueCallback<MessageChannel> callback); |
| + |
| private native long nativeGetNativeImeAdapter(long nativeContentViewCoreImpl); |
| private native int nativeGetCurrentRenderProcessId(long nativeContentViewCoreImpl); |