Move AppWindowContentsImpl to extensions
[chromium-blink-merge.git] / content / common / gin_java_bridge_messages.h
blobcbce41385438e33daf3e312d43d3b036d3a3fb9d
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // IPC messages for injected Java objects (Gin-based implementation).
7 // Multiply-included message file, hence no include guard.
9 #include "base/basictypes.h"
10 #include "content/common/android/gin_java_bridge_errors.h"
11 #include "content/common/content_export.h"
12 #include "ipc/ipc_message_macros.h"
14 #undef IPC_MESSAGE_EXPORT
15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
16 #define IPC_MESSAGE_START GinJavaBridgeMsgStart
18 // Messages for handling Java objects injected into JavaScript -----------------
20 IPC_ENUM_TRAITS(content::GinJavaBridgeError)
22 // Sent from browser to renderer to add a Java object with the given name.
23 // Object IDs are generated on the browser side.
24 IPC_MESSAGE_ROUTED2(GinJavaBridgeMsg_AddNamedObject,
25 std::string /* name */,
26 int32 /* object_id */)
28 // Sent from browser to renderer to remove a Java object with the given name.
29 IPC_MESSAGE_ROUTED1(GinJavaBridgeMsg_RemoveNamedObject,
30 std::string /* name */)
32 // Sent from renderer to browser to get information about methods of
33 // the given object. The query will only succeed if inspection of injected
34 // objects is enabled on the browser side.
35 IPC_SYNC_MESSAGE_ROUTED1_1(GinJavaBridgeHostMsg_GetMethods,
36 int32 /* object_id */,
37 std::set<std::string> /* returned_method_names */)
39 // Sent from renderer to browser to find out, if an object has a method with
40 // the given name.
41 IPC_SYNC_MESSAGE_ROUTED2_1(GinJavaBridgeHostMsg_HasMethod,
42 int32 /* object_id */,
43 std::string /* method_name */,
44 bool /* result */)
46 // Sent from renderer to browser to invoke a method. Method arguments
47 // are chained into |arguments| list. base::ListValue is used for |result| as
48 // a container to work around immutability of base::Value.
49 // Empty result list indicates that an error has happened on the Java side
50 // (either bridge-induced error or an unhandled Java exception) and an exception
51 // must be thrown into JavaScript. |error_code| indicates the cause of
52 // the error.
53 // Some special value types that are not supported by base::Value are encoded
54 // as BinaryValues via GinJavaBridgeValue.
55 IPC_SYNC_MESSAGE_ROUTED3_2(GinJavaBridgeHostMsg_InvokeMethod,
56 int32 /* object_id */,
57 std::string /* method_name */,
58 base::ListValue /* arguments */,
59 base::ListValue /* result */,
60 content::GinJavaBridgeError /* error_code */)
62 // Sent from renderer to browser in two cases:
64 // 1. (Main usage) To inform that the JS wrapper of the object has
65 // been completely dereferenced and garbage-collected.
67 // 2. To notify the browser that wrapper creation has failed. The browser side
68 // assumes optimistically that every time an object is returned from a
69 // method, the corresponding wrapper object will be successfully created on
70 // the renderer side. Sending of this message informs the browser whether
71 // this expectation has failed.
72 IPC_MESSAGE_ROUTED1(GinJavaBridgeHostMsg_ObjectWrapperDeleted,
73 int32 /* object_id */)