exclude GcdPrivateAPITest.AddRemove from browser_tests Dr.Memory bot
[chromium-blink-merge.git] / content / common / service_worker / service_worker_messages.h
blobc5eae1889383eb2d9d6a14e4dec4afa08d4d6018
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 // Message definition file, included multiple times, hence no include guard.
7 #include "base/strings/string16.h"
8 #include "content/common/service_worker/service_worker_status_code.h"
9 #include "content/common/service_worker/service_worker_types.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "ipc/ipc_param_traits.h"
12 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
13 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h"
14 #include "url/gurl.h"
16 #undef IPC_MESSAGE_EXPORT
17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
19 #define IPC_MESSAGE_START ServiceWorkerMsgStart
21 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerError::ErrorType,
22 blink::WebServiceWorkerError::ErrorTypeLast)
24 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerEventResult,
25 blink::WebServiceWorkerEventResultLast)
27 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerState,
28 blink::WebServiceWorkerStateLast)
30 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
31 IPC_STRUCT_TRAITS_MEMBER(url)
32 IPC_STRUCT_TRAITS_MEMBER(method)
33 IPC_STRUCT_TRAITS_MEMBER(headers)
34 IPC_STRUCT_TRAITS_MEMBER(is_reload)
35 IPC_STRUCT_TRAITS_END()
37 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerFetchEventResult,
38 content::SERVICE_WORKER_FETCH_EVENT_LAST)
40 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerResponse)
41 IPC_STRUCT_TRAITS_MEMBER(status_code)
42 IPC_STRUCT_TRAITS_MEMBER(status_text)
43 IPC_STRUCT_TRAITS_MEMBER(headers)
44 IPC_STRUCT_TRAITS_MEMBER(blob_uuid)
45 IPC_STRUCT_TRAITS_END()
47 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerObjectInfo)
48 IPC_STRUCT_TRAITS_MEMBER(handle_id)
49 IPC_STRUCT_TRAITS_MEMBER(scope)
50 IPC_STRUCT_TRAITS_MEMBER(url)
51 IPC_STRUCT_TRAITS_MEMBER(state)
52 IPC_STRUCT_TRAITS_END()
54 //---------------------------------------------------------------------------
55 // Messages sent from the child process to the browser.
57 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_RegisterServiceWorker,
58 int /* thread_id */,
59 int /* request_id */,
60 int /* provider_id */,
61 GURL /* scope */,
62 GURL /* script_url */)
64 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_UnregisterServiceWorker,
65 int /* thread_id */,
66 int /* request_id */,
67 int /* provider_id */,
68 GURL /* scope (url pattern) */)
70 // Sends a 'message' event to a service worker (renderer->browser).
71 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_PostMessageToWorker,
72 int /* handle_id */,
73 base::string16 /* message */,
74 std::vector<int> /* sent_message_port_ids */)
76 // Informs the browser of a new ServiceWorkerProvider in the child process,
77 // |provider_id| is unique within its child process.
78 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated,
79 int /* provider_id */)
81 // Informs the browser of a ServiceWorkerProvider being destroyed.
82 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed,
83 int /* provider_id */)
85 // Increments and decrements the ServiceWorker object's reference
86 // counting in the browser side. The ServiceWorker object is created
87 // with ref-count==1 initially.
88 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount,
89 int /* handle_id */)
90 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount,
91 int /* handle_id */)
93 // Informs the browser that |provider_id| is associated
94 // with a service worker script running context and
95 // |version_id| identifies which ServcieWorkerVersion.
96 IPC_MESSAGE_CONTROL2(ServiceWorkerHostMsg_SetVersionId,
97 int /* provider_id */,
98 int64 /* version_id */)
100 // Informs the browser that event handling has finished.
101 // Routed to the target ServiceWorkerVersion.
102 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_InstallEventFinished,
103 int /* request_id */,
104 blink::WebServiceWorkerEventResult)
105 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_ActivateEventFinished,
106 int /* request_id */,
107 blink::WebServiceWorkerEventResult)
108 IPC_MESSAGE_ROUTED3(ServiceWorkerHostMsg_FetchEventFinished,
109 int /* request_id */,
110 content::ServiceWorkerFetchEventResult,
111 content::ServiceWorkerResponse)
112 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_SyncEventFinished,
113 int /* request_id */)
114 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_PushEventFinished,
115 int /* request_id */)
117 // Asks the browser to retrieve documents controlled by the sender
118 // ServiceWorker.
119 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_GetClientDocuments,
120 int /* request_id */)
122 // Sends a 'message' event to a client document (renderer->browser).
123 IPC_MESSAGE_ROUTED3(ServiceWorkerHostMsg_PostMessageToDocument,
124 int /* client_id */,
125 base::string16 /* message */,
126 std::vector<int> /* sent_message_port_ids */)
128 //---------------------------------------------------------------------------
129 // Messages sent from the browser to the child process.
131 // NOTE: All ServiceWorkerMsg messages not sent via EmbeddedWorker must have
132 // a thread_id as their first field so that ServiceWorkerMessageFilter can
133 // extract it and dispatch the message to the correct ServiceWorkerDispatcher
134 // on the correct thread.
136 // Response to ServiceWorkerMsg_RegisterServiceWorker.
137 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerRegistered,
138 int /* thread_id */,
139 int /* request_id */,
140 content::ServiceWorkerObjectInfo)
142 // Response to ServiceWorkerMsg_UnregisterServiceWorker.
143 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_ServiceWorkerUnregistered,
144 int /* thread_id */,
145 int /* request_id */)
147 // Sent when any kind of registration error occurs during a
148 // RegisterServiceWorker / UnregisterServiceWorker handler above.
149 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
150 int /* thread_id */,
151 int /* request_id */,
152 blink::WebServiceWorkerError::ErrorType /* code */,
153 base::string16 /* message */)
155 // Informs the child process that the ServiceWorker's state has changed.
156 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerStateChanged,
157 int /* thread_id */,
158 int /* handle_id */,
159 blink::WebServiceWorkerState)
161 // Tells the child process to set the installing ServiceWorker for the given
162 // provider.
163 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetInstallingServiceWorker,
164 int /* thread_id */,
165 int /* provider_id */,
166 content::ServiceWorkerObjectInfo)
168 // Tells the child process to set the waiting ServiceWorker for the given
169 // provider.
170 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetWaitingServiceWorker,
171 int /* thread_id */,
172 int /* provider_id */,
173 content::ServiceWorkerObjectInfo)
175 // Tells the child process to set the active ServiceWorker for the given
176 // provider.
177 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetActiveServiceWorker,
178 int /* thread_id */,
179 int /* provider_id */,
180 content::ServiceWorkerObjectInfo)
182 // Tells the child process to set the controller ServiceWorker for the given
183 // provider.
184 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetControllerServiceWorker,
185 int /* thread_id */,
186 int /* provider_id */,
187 content::ServiceWorkerObjectInfo)
189 // Sends a 'message' event to a client document (browser->renderer).
190 IPC_MESSAGE_CONTROL5(ServiceWorkerMsg_MessageToDocument,
191 int /* thread_id */,
192 int /* provider_id */,
193 base::string16 /* message */,
194 std::vector<int> /* sent_message_port_ids */,
195 std::vector<int> /* new_routing_ids */)
197 // Sent via EmbeddedWorker to dispatch events.
198 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_InstallEvent,
199 int /* request_id */,
200 int /* active_version_id */)
201 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent,
202 int /* request_id */)
203 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent,
204 int /* request_id */,
205 content::ServiceWorkerFetchRequest)
206 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_SyncEvent,
207 int /* request_id */)
208 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_PushEvent,
209 int /* request_id */,
210 std::string /* data */)
211 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_MessageToWorker,
212 base::string16 /* message */,
213 std::vector<int> /* sent_message_port_ids */,
214 std::vector<int> /* new_routing_ids */)
216 // Sent via EmbeddedWorker as a response of GetClientDocuments.
217 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DidGetClientDocuments,
218 int /* request_id */,
219 std::vector<int> /* client_ids */)