1 // Copyright (c) 2013 Intel Corporation. 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.
8 #include "base/memory/shared_memory.h"
9 #include "base/values.h"
10 #include "ipc/ipc_channel_handle.h"
11 #include "ipc/ipc_message_macros.h"
12 #include "xwalk/extensions/common/xwalk_extension_permission_types.h"
14 // Note: it is safe to use numbers after LastIPCMsgStart since that limit
15 // is not relevant for embedders. It is used only by a tool inside chrome/
16 // that we currently don't use.
17 // See also https://code.google.com/p/chromium/issues/detail?id=110911.
18 #ifndef XWALK_EXTENSIONS_COMMON_XWALK_EXTENSION_MESSAGES_H_
19 #define XWALK_EXTENSIONS_COMMON_XWALK_EXTENSION_MESSAGES_H_
21 XWalkExtensionMsgStart = LastIPCMsgStart + 1,
22 XWalkExtensionClientServerMsgStart
24 #endif // XWALK_EXTENSIONS_COMMON_XWALK_EXTENSION_MESSAGES_H_
27 #define IPC_MESSAGE_START XWalkExtensionMsgStart
29 IPC_MESSAGE_CONTROL2(XWalkExtensionProcessMsg_RegisterExtensions, // NOLINT(*)
30 base::FilePath /* extensions path */,
31 base::ListValue /* browser variables */)
33 // This implies that extensions are all loaded and Extension Process
34 // is ready to be used.
35 IPC_MESSAGE_CONTROL1(XWalkExtensionProcessHostMsg_RenderProcessChannelCreated, // NOLINT(*)
36 IPC::ChannelHandle /* channel id */)
38 // Message from Render Process to Browser Process. This message needs
39 // to be synchronous because Render Process cannot load anything without having
40 // collected the extensions loaded in Extension Process.
41 IPC_SYNC_MESSAGE_CONTROL0_1(XWalkExtensionProcessHostMsg_GetExtensionProcessChannel, // NOLINT(*)
42 IPC::ChannelHandle /* channel id */)
44 // Message from Extension Process to Browser Process
45 IPC_ENUM_TRAITS_MAX_VALUE(xwalk::extensions::RuntimePermission,
46 xwalk::extensions::UNDEFINED_RUNTIME_PERM)
47 IPC_SYNC_MESSAGE_CONTROL2_1(XWalkExtensionProcessHostMsg_CheckAPIAccessControl, // NOLINT(*)
50 xwalk::extensions::RuntimePermission)
51 IPC_SYNC_MESSAGE_CONTROL2_1(XWalkExtensionProcessHostMsg_RegisterPermissions, // NOLINT(*)
56 // We use a separated message class for Client<->Server communication
58 #undef IPC_MESSAGE_START
59 #define IPC_MESSAGE_START XWalkExtensionClientServerMsgStart
61 IPC_STRUCT_BEGIN(XWalkExtensionServerMsg_ExtensionRegisterParams)
62 IPC_STRUCT_MEMBER(std::string, name)
63 IPC_STRUCT_MEMBER(std::string, js_api)
64 IPC_STRUCT_MEMBER(std::vector<std::string>, entry_points)
67 IPC_MESSAGE_CONTROL2(XWalkExtensionServerMsg_CreateInstance, // NOLINT(*)
68 int64_t /* instance id */,
69 std::string /* extension name */)
71 IPC_MESSAGE_CONTROL2(XWalkExtensionServerMsg_PostMessageToNative, // NOLINT(*)
72 int64_t /* instance id */,
73 base::ListValue /* contents */)
75 IPC_MESSAGE_CONTROL2(XWalkExtensionClientMsg_PostMessageToJS, // NOLINT(*)
76 int64_t /* instance id */,
77 base::ListValue /* contents */)
79 IPC_MESSAGE_CONTROL2(XWalkExtensionClientMsg_PostOutOfLineMessageToJS, // NOLINT(*)
80 base::SharedMemoryHandle /* message buffer */,
81 size_t /* buffer size */)
83 IPC_SYNC_MESSAGE_CONTROL2_1(XWalkExtensionServerMsg_SendSyncMessageToNative, // NOLINT(*)
84 int64_t /* instance id */,
85 base::ListValue /* input contents */,
86 base::ListValue /* output contents */)
88 IPC_SYNC_MESSAGE_CONTROL0_1(XWalkExtensionServerMsg_GetExtensions, // NOLINT(*)
89 std::vector<XWalkExtensionServerMsg_ExtensionRegisterParams> /* output contents */) // NOLINT(*)
91 IPC_MESSAGE_CONTROL1(XWalkExtensionServerMsg_DestroyInstance, // NOLINT(*)
92 int64_t /* instance id */)
94 IPC_MESSAGE_CONTROL1(XWalkExtensionClientMsg_InstanceDestroyed, // NOLINT(*)
95 int64_t /* instance id */)