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

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

Issue 387113003: Add a content API to create a message channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address mikhail's comments Created 6 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 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);

Powered by Google App Engine
This is Rietveld 408576698