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

Unified Diff: content/browser/android/app_web_message_port.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… Created 3 years, 10 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
« no previous file with comments | « content/browser/android/DEPS ('k') | content/browser/android/app_web_message_port.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/app_web_message_port.h
diff --git a/content/browser/android/app_web_message_port.h b/content/browser/android/app_web_message_port.h
new file mode 100644
index 0000000000000000000000000000000000000000..147c9f6fefca19c1dbcf35d337c3fb43be36827e
--- /dev/null
+++ b/content/browser/android/app_web_message_port.h
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ANDROID_APP_WEB_MESSAGE_PORT_H_
+#define CONTENT_BROWSER_ANDROID_APP_WEB_MESSAGE_PORT_H_
+
+#include "base/android/jni_weak_ref.h"
+#include "content/common/message_port.h"
+
+namespace content {
+
+class AppWebMessagePort {
+ public:
+ static void CreateAndBindToJavaObject(
+ JNIEnv* env,
+ mojo::ScopedMessagePipeHandle handle,
+ const base::android::JavaRef<jobject>& jobject);
+
+ static std::vector<MessagePort> UnwrapJavaArray(
+ JNIEnv* env,
+ const base::android::JavaRef<jobjectArray>& jports);
+
+ // Methods called from Java.
+ void CloseMessagePort(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller);
+ void PostMessage(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller,
+ const base::android::JavaParamRef<jstring>& jmessage,
+ const base::android::JavaParamRef<jobjectArray>& jports);
+ jboolean DispatchNextMessage(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller);
+ void StartReceivingMessages(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& jcaller);
+
+ private:
+ explicit AppWebMessagePort(
+ JNIEnv* env,
+ mojo::ScopedMessagePipeHandle handle,
+ const base::android::JavaRef<jobject>& jobject);
+ ~AppWebMessagePort();
+
+ void OnMessagesAvailable();
+
+ MessagePort port_;
+ JavaObjectWeakGlobalRef java_ref_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppWebMessagePort);
+};
+
+bool RegisterAppWebMessagePort(JNIEnv* env);
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_ANDROID_APP_WEB_MESSAGE_PORT_H_
« no previous file with comments | « content/browser/android/DEPS ('k') | content/browser/android/app_web_message_port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698