Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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. | |
| 4 | |
| 5 // IPC messages for injected Java objects (Gin-based implementation). | |
| 6 | |
| 7 // Multiply-included message file, hence no include guard. | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "ipc/ipc_message_macros.h" | |
| 12 | |
| 13 #undef IPC_MESSAGE_EXPORT | |
| 14 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | |
| 15 #define IPC_MESSAGE_START GinJavaBridgeMsgStart | |
| 16 | |
| 17 // Messages for handling Java objects injected into JavaScript ----------------- | |
| 18 | |
| 19 // Sent from browser to renderer to add a Java object with the given name. | |
| 20 // Object IDs are generated on the browser side. | |
| 21 IPC_MESSAGE_ROUTED2(GinJavaBridgeMsg_AddNamedObject, | |
| 22 std::string /* name */, | |
| 23 int32 /* object_id */) | |
| 24 | |
| 25 // Sent from browser to renderer to remove a Java object with the given name. | |
|
palmer
2014/04/25 22:37:06
This should be merely advisory, for the benefit of
mnaganov (inactive)
2014/04/28 11:38:43
Yes, that's correct.
| |
| 26 IPC_MESSAGE_ROUTED1(GinJavaBridgeMsg_RemoveNamedObject, | |
| 27 std::string /* name */) | |
| 28 | |
| 29 // Sent from browser to renderer to control enumerability of methods exposed | |
|
palmer
2014/04/25 22:37:06
Does this mean we trust the renderer to not expose
mnaganov (inactive)
2014/04/28 11:38:43
OK, I will make renderers to query for method name
| |
| 30 // by injected objects. | |
| 31 IPC_MESSAGE_ROUTED1(GinJavaBridgeMsg_SetAllowObjectContentsInspection, | |
| 32 bool /* allow */) | |
| 33 | |
| 34 // Sent from renderer to browser to get information about methods of | |
| 35 // the given object. | |
| 36 IPC_SYNC_MESSAGE_ROUTED1_1(GinJavaBridgeHostMsg_GetMethods, | |
| 37 int32 /* object_id */, | |
| 38 std::set<std::string> /* returned_method_names */) | |
| 39 | |
| 40 // Sent from renderer to browser to invoke a method. Method arguments | |
| 41 // are chained into |arguments| list. base::ListValue is used for |result| as | |
| 42 // a container to work around immutability of base::Value. | |
| 43 // Empty result list indicates that an error has happened on the Java side | |
| 44 // (either bridge-induced error or an unhandled Java exception) and an exception | |
| 45 // must be thrown into JavaScript. | |
| 46 // Some special value types that are not supported by base::Value are encoded | |
| 47 // as BinaryValues via GinJavaBridgeValue. | |
| 48 IPC_SYNC_MESSAGE_ROUTED3_1(GinJavaBridgeHostMsg_InvokeMethod, | |
| 49 int32 /* object_id */, | |
| 50 std::string /* method_name */, | |
| 51 base::ListValue /* arguments */, | |
| 52 base::ListValue /* result */) | |
| 53 | |
| 54 // Sent from renderer to browser to inform that the JS wrapper of the object has | |
| 55 // been completely dereferenced and garbage-collected. Also used in a situation | |
| 56 // when wrapper creation has failed. The browser side, assumes | |
| 57 // optimistically that every time an object is returned from a method, a | |
| 58 // corresponding wrapper will be successfully created on the renderer side. | |
|
palmer
2014/04/25 22:37:06
What happens if the optimistic assumption does not
mnaganov (inactive)
2014/04/28 11:38:43
Then the renderer sends this message. I'll try to
| |
| 59 IPC_MESSAGE_ROUTED1(GinJavaBridgeHostMsg_ObjectWrapperDeleted, | |
| 60 int32 /* object_id */) | |
| OLD | NEW |