summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 10:26:43 +0000
committermnaganov@chromium.org <mnaganov@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-06 10:26:43 +0000
commite02b600a3610884722048ec00584ac983870b5e9 (patch)
tree0b750b572e3e64d9dd4ea172a70d502bf9e3add3
parent4c5b580df64b283607df49bb3f0d8e0713caeee2 (diff)
downloadchromium_src-e02b600a3610884722048ec00584ac983870b5e9.zip
chromium_src-e02b600a3610884722048ec00584ac983870b5e9.tar.gz
chromium_src-e02b600a3610884722048ec00584ac983870b5e9.tar.bz2
[Android] Add messages for Gin Java Bridge implementation
BUG=355644 Review URL: https://codereview.chromium.org/249473002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268480 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/common/content_message_generator.h1
-rw-r--r--content/common/gin_java_bridge_messages.h68
-rw-r--r--content/content_common.gypi1
-rw-r--r--ipc/ipc_message_start.h1
4 files changed, 71 insertions, 0 deletions
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index ca2dda1..07943e8 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -60,6 +60,7 @@
#include "content/common/worker_messages.h"
#if defined(OS_ANDROID)
+#include "content/common/gin_java_bridge_messages.h"
#include "content/common/media/cdm_messages.h"
#include "content/common/media/media_player_messages_android.h"
#endif // defined(OS_ANDROID)
diff --git a/content/common/gin_java_bridge_messages.h b/content/common/gin_java_bridge_messages.h
new file mode 100644
index 0000000..f9525b1
--- /dev/null
+++ b/content/common/gin_java_bridge_messages.h
@@ -0,0 +1,68 @@
+// Copyright 2014 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.
+
+// IPC messages for injected Java objects (Gin-based implementation).
+
+// Multiply-included message file, hence no include guard.
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+#include "ipc/ipc_message_macros.h"
+
+#undef IPC_MESSAGE_EXPORT
+#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
+#define IPC_MESSAGE_START GinJavaBridgeMsgStart
+
+// Messages for handling Java objects injected into JavaScript -----------------
+
+// Sent from browser to renderer to add a Java object with the given name.
+// Object IDs are generated on the browser side.
+IPC_MESSAGE_ROUTED2(GinJavaBridgeMsg_AddNamedObject,
+ std::string /* name */,
+ int32 /* object_id */)
+
+// Sent from browser to renderer to remove a Java object with the given name.
+IPC_MESSAGE_ROUTED1(GinJavaBridgeMsg_RemoveNamedObject,
+ std::string /* name */)
+
+// Sent from renderer to browser to get information about methods of
+// the given object. The query will only succeed if inspection of injected
+// objects is enabled on the browser side.
+IPC_SYNC_MESSAGE_ROUTED1_1(GinJavaBridgeHostMsg_GetMethods,
+ int32 /* object_id */,
+ std::set<std::string> /* returned_method_names */)
+
+// Sent from renderer to browser to find out, if an object has a method with
+// the given name.
+IPC_SYNC_MESSAGE_ROUTED2_1(GinJavaBridgeHostMsg_HasMethod,
+ int32 /* object_id */,
+ std::string /* method_name */,
+ bool /* result */)
+
+// Sent from renderer to browser to invoke a method. Method arguments
+// are chained into |arguments| list. base::ListValue is used for |result| as
+// a container to work around immutability of base::Value.
+// Empty result list indicates that an error has happened on the Java side
+// (either bridge-induced error or an unhandled Java exception) and an exception
+// must be thrown into JavaScript.
+// Some special value types that are not supported by base::Value are encoded
+// as BinaryValues via GinJavaBridgeValue.
+IPC_SYNC_MESSAGE_ROUTED3_1(GinJavaBridgeHostMsg_InvokeMethod,
+ int32 /* object_id */,
+ std::string /* method_name */,
+ base::ListValue /* arguments */,
+ base::ListValue /* result */)
+
+// Sent from renderer to browser in two cases:
+//
+// 1. (Main usage) To inform that the JS wrapper of the object has
+// been completely dereferenced and garbage-collected.
+//
+// 2. To notify the browser that wrapper creation has failed. The browser side
+// assumes optimistically that every time an object is returned from a
+// method, the corresponding wrapper object will be successfully created on
+// the renderer side. Sending of this message informs the browser whether
+// this expectation has failed.
+IPC_MESSAGE_ROUTED1(GinJavaBridgeHostMsg_ObjectWrapperDeleted,
+ int32 /* object_id */)
diff --git a/content/content_common.gypi b/content/content_common.gypi
index e2cff54..ff70a16 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -215,6 +215,7 @@
'common/gamepad_user_gesture.cc',
'common/gamepad_user_gesture.h',
'common/geolocation_messages.h',
+ 'common/gin_java_bridge_messages.h',
'common/gpu/client/command_buffer_proxy_impl.cc',
'common/gpu/client/command_buffer_proxy_impl.h',
'common/gpu/client/context_provider_command_buffer.cc',
diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h
index 6474eab..0d8193c 100644
--- a/ipc/ipc_message_start.h
+++ b/ipc/ipc_message_start.h
@@ -102,6 +102,7 @@ enum IPCMessageStart {
MojoMsgStart,
TranslateMsgStart,
PushMessagingMsgStart,
+ GinJavaBridgeMsgStart,
LastIPCMsgStart // Must come last.
};