Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / common / message_port_messages.h
blobd2c6fb8e8a6936a1fa2d38876f9dbf67ea04e7ed
1 // Copyright 2013 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 // Defines messages between the browser and worker process, as well as between
6 // the renderer and worker process.
8 // Multiply-included message file, hence no include guard.
10 #include <string>
11 #include <utility>
12 #include <vector>
14 #include "base/basictypes.h"
15 #include "base/strings/string16.h"
16 #include "content/common/content_export.h"
17 #include "content/public/common/message_port_types.h"
18 #include "ipc/ipc_message_macros.h"
19 #include "ipc/ipc_message_utils.h"
21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
23 #define IPC_MESSAGE_START MessagePortMsgStart
25 // Singly-included section for typedefs.
26 #ifndef CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
27 #define CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
29 typedef std::pair<content::MessagePortMessage,
30 std::vector<content::TransferredMessagePort>> QueuedMessage;
32 #endif // CONTENT_COMMON_MESSAGE_PORT_MESSAGES_H_
34 IPC_STRUCT_TRAITS_BEGIN(content::MessagePortMessage)
35 IPC_STRUCT_TRAITS_MEMBER(message_as_string)
36 IPC_STRUCT_TRAITS_MEMBER(message_as_value)
37 IPC_STRUCT_TRAITS_END()
39 IPC_STRUCT_TRAITS_BEGIN(content::TransferredMessagePort)
40 IPC_STRUCT_TRAITS_MEMBER(id)
41 IPC_STRUCT_TRAITS_MEMBER(send_messages_as_values)
42 IPC_STRUCT_TRAITS_END()
44 //-----------------------------------------------------------------------------
45 // MessagePort messages
46 // These are messages sent from the browser to child processes.
48 // Sends a message to a message port.
49 IPC_MESSAGE_ROUTED3(
50 MessagePortMsg_Message,
51 content::MessagePortMessage /* message */,
52 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
53 std::vector<int> /* new_routing_ids */)
55 // Tells the Message Port Channel object that there are no more in-flight
56 // messages arriving.
57 IPC_MESSAGE_ROUTED0(MessagePortMsg_MessagesQueued)
59 //-----------------------------------------------------------------------------
60 // MessagePortHost messages
61 // These are messages sent from child processes to the browser.
63 // Creates a new Message Port Channel object. The first paramaeter is the
64 // message port channel's routing id in this process. The second parameter
65 // is the process-wide-unique identifier for that port.
66 IPC_SYNC_MESSAGE_CONTROL0_2(MessagePortHostMsg_CreateMessagePort,
67 int /* route_id */,
68 int /* message_port_id */)
70 // Sent when a Message Port Channel object is destroyed.
71 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_DestroyMessagePort,
72 int /* message_port_id */)
74 // Sends a message to a message port. Optionally sends a message port as
75 // as well if sent_message_port_id != MSG_ROUTING_NONE.
76 IPC_MESSAGE_CONTROL3(
77 MessagePortHostMsg_PostMessage,
78 int /* sender_message_port_id */,
79 content::MessagePortMessage /* message */,
80 std::vector<content::TransferredMessagePort> /* sent_message_ports */)
82 // Causes messages sent to the remote port to be delivered to this local port.
83 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_Entangle,
84 int /* local_message_port_id */,
85 int /* remote_message_port_id */)
87 // Causes the browser to queue messages sent to this port until the the port
88 // has made sure that all in-flight messages were routed to the new
89 // destination.
90 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_QueueMessages,
91 int /* message_port_id */)
93 // Sends the browser all the queued messages that arrived at this message port
94 // after it was sent in a postMessage call.
95 // NOTE: MSVS can't compile the macro if std::vector<std::pair<string16, int> >
96 // is used, so we typedef it in worker_messages.h.
97 IPC_MESSAGE_CONTROL2(MessagePortHostMsg_SendQueuedMessages,
98 int /* message_port_id */,
99 std::vector<QueuedMessage> /* queued_messages */)
101 // Tells the browser this message port is ready to receive messages. If the
102 // browser was holding messages to this port because no destination for the
103 // port was available yet this will cause the browser to release those messages.
104 IPC_MESSAGE_CONTROL1(MessagePortHostMsg_ReleaseMessages,
105 int /* message_port_id */)