We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / content / common / service_worker / service_worker_messages.h
blob00eb170efc29b99b53b971560eba282aa25099df
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 <string>
8 #include <vector>
10 #include "base/strings/string16.h"
11 #include "content/common/service_worker/service_worker_client_info.h"
12 #include "content/common/service_worker/service_worker_status_code.h"
13 #include "content/common/service_worker/service_worker_types.h"
14 #include "content/public/common/message_port_types.h"
15 #include "content/public/common/navigator_connect_client.h"
16 #include "content/public/common/platform_notification_data.h"
17 #include "ipc/ipc_message_macros.h"
18 #include "ipc/ipc_param_traits.h"
19 #include "third_party/WebKit/public/platform/WebCircularGeofencingRegion.h"
20 #include "third_party/WebKit/public/platform/WebGeofencingEventType.h"
21 #include "third_party/WebKit/public/platform/WebServiceWorkerError.h"
22 #include "third_party/WebKit/public/platform/WebServiceWorkerEventResult.h"
23 #include "url/gurl.h"
25 #undef IPC_MESSAGE_EXPORT
26 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
28 #define IPC_MESSAGE_START ServiceWorkerMsgStart
30 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerError::ErrorType,
31 blink::WebServiceWorkerError::ErrorTypeLast)
33 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerEventResult,
34 blink::WebServiceWorkerEventResultLast)
36 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerState,
37 blink::WebServiceWorkerStateLast)
39 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerResponseType,
40 blink::WebServiceWorkerResponseTypeLast)
42 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerClientType,
43 blink::WebServiceWorkerClientTypeLast)
45 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerProviderType,
46 content::SERVICE_WORKER_PROVIDER_TYPE_LAST)
48 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
49 IPC_STRUCT_TRAITS_MEMBER(mode)
50 IPC_STRUCT_TRAITS_MEMBER(request_context_type)
51 IPC_STRUCT_TRAITS_MEMBER(frame_type)
52 IPC_STRUCT_TRAITS_MEMBER(url)
53 IPC_STRUCT_TRAITS_MEMBER(method)
54 IPC_STRUCT_TRAITS_MEMBER(headers)
55 IPC_STRUCT_TRAITS_MEMBER(blob_uuid)
56 IPC_STRUCT_TRAITS_MEMBER(blob_size)
57 IPC_STRUCT_TRAITS_MEMBER(referrer)
58 IPC_STRUCT_TRAITS_MEMBER(credentials_mode)
59 IPC_STRUCT_TRAITS_MEMBER(is_reload)
60 IPC_STRUCT_TRAITS_END()
62 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerFetchEventResult,
63 content::SERVICE_WORKER_FETCH_EVENT_LAST)
65 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerResponse)
66 IPC_STRUCT_TRAITS_MEMBER(url)
67 IPC_STRUCT_TRAITS_MEMBER(status_code)
68 IPC_STRUCT_TRAITS_MEMBER(status_text)
69 IPC_STRUCT_TRAITS_MEMBER(response_type)
70 IPC_STRUCT_TRAITS_MEMBER(headers)
71 IPC_STRUCT_TRAITS_MEMBER(blob_uuid)
72 IPC_STRUCT_TRAITS_MEMBER(blob_size)
73 IPC_STRUCT_TRAITS_MEMBER(stream_url)
74 IPC_STRUCT_TRAITS_END()
76 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerObjectInfo)
77 IPC_STRUCT_TRAITS_MEMBER(handle_id)
78 IPC_STRUCT_TRAITS_MEMBER(url)
79 IPC_STRUCT_TRAITS_MEMBER(state)
80 IPC_STRUCT_TRAITS_MEMBER(version_id)
81 IPC_STRUCT_TRAITS_END()
83 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerRegistrationObjectInfo)
84 IPC_STRUCT_TRAITS_MEMBER(handle_id)
85 IPC_STRUCT_TRAITS_MEMBER(scope)
86 IPC_STRUCT_TRAITS_MEMBER(registration_id)
87 IPC_STRUCT_TRAITS_END()
89 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerVersionAttributes)
90 IPC_STRUCT_TRAITS_MEMBER(installing)
91 IPC_STRUCT_TRAITS_MEMBER(waiting)
92 IPC_STRUCT_TRAITS_MEMBER(active)
93 IPC_STRUCT_TRAITS_END()
95 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerClientInfo)
96 IPC_STRUCT_TRAITS_MEMBER(client_uuid)
97 IPC_STRUCT_TRAITS_MEMBER(page_visibility_state)
98 IPC_STRUCT_TRAITS_MEMBER(is_focused)
99 IPC_STRUCT_TRAITS_MEMBER(url)
100 IPC_STRUCT_TRAITS_MEMBER(frame_type)
101 IPC_STRUCT_TRAITS_MEMBER(client_type)
102 IPC_STRUCT_TRAITS_END()
104 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerClientQueryOptions)
105 IPC_STRUCT_TRAITS_MEMBER(client_type)
106 IPC_STRUCT_TRAITS_MEMBER(include_uncontrolled)
107 IPC_STRUCT_TRAITS_END()
109 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebGeofencingEventType,
110 blink::WebGeofencingEventTypeLast)
112 //---------------------------------------------------------------------------
113 // Messages sent from the child process to the browser.
115 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_RegisterServiceWorker,
116 int /* thread_id */,
117 int /* request_id */,
118 int /* provider_id */,
119 GURL /* scope */,
120 GURL /* script_url */)
122 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_UnregisterServiceWorker,
123 int /* thread_id */,
124 int /* request_id */,
125 int /* provider_id */,
126 GURL /* scope (url pattern) */)
128 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_GetRegistration,
129 int /* thread_id */,
130 int /* request_id */,
131 int /* provider_id */,
132 GURL /* document_url */)
134 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_GetRegistrationForReady,
135 int /* thread_id */,
136 int /* request_id */,
137 int /* provider_id */)
139 // Sends a 'message' event to a service worker (renderer->browser).
140 IPC_MESSAGE_CONTROL3(
141 ServiceWorkerHostMsg_PostMessageToWorker,
142 int /* handle_id */,
143 base::string16 /* message */,
144 std::vector<content::TransferredMessagePort> /* sent_message_ports */)
146 // Informs the browser of a new ServiceWorkerProvider in the child process,
147 // |provider_id| is unique within its child process.
148 // |render_frame_id| identifies the frame associated with the provider, it will
149 // it will be MSG_ROUTING_NONE if the context is a worker instead of a document.
150 // |provider_type| identifies whether this provider is for ServiceWorker
151 // controllees (documents and SharedWorkers) or for controllers
152 // (ServiceWorkers).
153 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_ProviderCreated,
154 int /* provider_id */,
155 int /* render_frame_id */,
156 content::ServiceWorkerProviderType /* provider_type */)
158 // Informs the browser of a ServiceWorkerProvider being destroyed.
159 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed,
160 int /* provider_id */)
162 // Increments and decrements the ServiceWorker object's reference
163 // counting in the browser side. The ServiceWorker object is created
164 // with ref-count==1 initially.
165 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount,
166 int /* handle_id */)
167 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount,
168 int /* handle_id */)
170 // Increments and decrements the ServiceWorkerRegistration object's reference
171 // counting in the browser side. The registration object is created with
172 // ref-count==1 initially.
173 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_IncrementRegistrationRefCount,
174 int /* registration_handle_id */)
175 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_DecrementRegistrationRefCount,
176 int /* registration_handle_id */)
178 // Tells the browser to terminate a service worker. Used in layout tests to
179 // verify behavior when a service worker isn't running.
180 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_TerminateWorker,
181 int /* handle_id */)
183 // Informs the browser that |provider_id| is associated
184 // with a service worker script running context and
185 // |version_id| identifies which ServiceWorkerVersion.
186 IPC_MESSAGE_CONTROL2(ServiceWorkerHostMsg_SetVersionId,
187 int /* provider_id */,
188 int64 /* version_id */)
190 // Informs the browser that event handling has finished.
191 // Routed to the target ServiceWorkerVersion.
192 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_InstallEventFinished,
193 int /* request_id */,
194 blink::WebServiceWorkerEventResult)
195 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_ActivateEventFinished,
196 int /* request_id */,
197 blink::WebServiceWorkerEventResult)
198 IPC_MESSAGE_ROUTED3(ServiceWorkerHostMsg_FetchEventFinished,
199 int /* request_id */,
200 content::ServiceWorkerFetchEventResult,
201 content::ServiceWorkerResponse)
202 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_SyncEventFinished,
203 int /* request_id */)
204 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_NotificationClickEventFinished,
205 int /* request_id */)
206 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_PushEventFinished,
207 int /* request_id */,
208 blink::WebServiceWorkerEventResult)
209 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_GeofencingEventFinished,
210 int /* request_id */)
211 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_CrossOriginConnectEventFinished,
212 int /* request_id */,
213 bool /* accept_connection */)
215 // Responds to a Ping from the browser.
216 // Routed to the target ServiceWorkerVersion.
217 IPC_MESSAGE_ROUTED0(ServiceWorkerHostMsg_Pong)
219 // Asks the browser to retrieve clients of the sender ServiceWorker.
220 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_GetClients,
221 int /* request_id */,
222 content::ServiceWorkerClientQueryOptions)
224 // Sends a 'message' event to a client (renderer->browser).
225 IPC_MESSAGE_ROUTED3(
226 ServiceWorkerHostMsg_PostMessageToClient,
227 std::string /* uuid */,
228 base::string16 /* message */,
229 std::vector<content::TransferredMessagePort> /* sent_message_ports */)
231 // ServiceWorker -> Browser message to request that the ServiceWorkerStorage
232 // cache |data| associated with |url|.
233 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_SetCachedMetadata,
234 GURL /* url */,
235 std::vector<char> /* data */)
237 // ServiceWorker -> Browser message to request that the ServiceWorkerStorage
238 // clear the cache associated with |url|.
239 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_ClearCachedMetadata, GURL /* url */)
241 // Ask the browser to open a tab/window (renderer->browser).
242 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_OpenWindow,
243 int /* request_id */,
244 GURL /* url */)
246 // Ask the browser to focus a client (renderer->browser).
247 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_FocusClient,
248 int /* request_id */,
249 std::string /* uuid */)
251 // Asks the browser to force this worker to become activated.
252 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_SkipWaiting,
253 int /* request_id */)
255 // Asks the browser to have this worker take control of pages that match
256 // its scope.
257 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_ClaimClients,
258 int /* request_id */)
260 //---------------------------------------------------------------------------
261 // Messages sent from the browser to the child process.
263 // NOTE: All ServiceWorkerMsg messages not sent via EmbeddedWorker must have
264 // a thread_id as their first field so that ServiceWorkerMessageFilter can
265 // extract it and dispatch the message to the correct ServiceWorkerDispatcher
266 // on the correct thread.
268 // Informs the child process of the registration associated with the service
269 // worker.
270 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_AssociateRegistrationWithServiceWorker,
271 int /* thread_id*/,
272 int /* provider_id */,
273 content::ServiceWorkerRegistrationObjectInfo,
274 content::ServiceWorkerVersionAttributes)
276 // Informs the child process that the given provider gets associated or
277 // disassociated with the registration.
278 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_AssociateRegistration,
279 int /* thread_id */,
280 int /* provider_id */,
281 content::ServiceWorkerRegistrationObjectInfo,
282 content::ServiceWorkerVersionAttributes)
283 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DisassociateRegistration,
284 int /* thread_id */,
285 int /* provider_id */)
287 // Response to ServiceWorkerHostMsg_RegisterServiceWorker.
288 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistered,
289 int /* thread_id */,
290 int /* request_id */,
291 content::ServiceWorkerRegistrationObjectInfo,
292 content::ServiceWorkerVersionAttributes)
294 // Response to ServiceWorkerHostMsg_UnregisterServiceWorker.
295 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerUnregistered,
296 int /* thread_id */,
297 int /* request_id */,
298 bool /* is_success */)
300 // Response to ServiceWorkerHostMsg_GetRegistration.
301 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_DidGetRegistration,
302 int /* thread_id */,
303 int /* request_id */,
304 content::ServiceWorkerRegistrationObjectInfo,
305 content::ServiceWorkerVersionAttributes)
307 // Response to ServiceWorkerHostMsg_GetRegistrationForReady.
308 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_DidGetRegistrationForReady,
309 int /* thread_id */,
310 int /* request_id */,
311 content::ServiceWorkerRegistrationObjectInfo,
312 content::ServiceWorkerVersionAttributes)
314 // Sent when any kind of registration error occurs during a
315 // RegisterServiceWorker handler above.
316 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
317 int /* thread_id */,
318 int /* request_id */,
319 blink::WebServiceWorkerError::ErrorType /* code */,
320 base::string16 /* message */)
322 // Sent when any kind of registration error occurs during a
323 // UnregisterServiceWorker handler above.
324 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerUnregistrationError,
325 int /* thread_id */,
326 int /* request_id */,
327 blink::WebServiceWorkerError::ErrorType /* code */,
328 base::string16 /* message */)
330 // Sent when any kind of registration error occurs during a
331 // GetRegistration handler above.
332 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerGetRegistrationError,
333 int /* thread_id */,
334 int /* request_id */,
335 blink::WebServiceWorkerError::ErrorType /* code */,
336 base::string16 /* message */)
338 // Informs the child process that the ServiceWorker's state has changed.
339 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerStateChanged,
340 int /* thread_id */,
341 int /* handle_id */,
342 blink::WebServiceWorkerState)
344 // Tells the child process to set service workers for the given provider.
345 IPC_MESSAGE_CONTROL5(ServiceWorkerMsg_SetVersionAttributes,
346 int /* thread_id */,
347 int /* provider_id */,
348 int /* registration_handle_id */,
349 int /* changed_mask */,
350 content::ServiceWorkerVersionAttributes)
352 // Informs the child process that new ServiceWorker enters the installation
353 // phase.
354 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_UpdateFound,
355 int /* thread_id */,
356 int /* registration_handle_id */)
358 // Tells the child process to set the controller ServiceWorker for the given
359 // provider.
360 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_SetControllerServiceWorker,
361 int /* thread_id */,
362 int /* provider_id */,
363 content::ServiceWorkerObjectInfo,
364 bool /* should_notify_controllerchange */)
366 // Sends a 'message' event to a client document (browser->renderer).
367 IPC_MESSAGE_CONTROL5(
368 ServiceWorkerMsg_MessageToDocument,
369 int /* thread_id */,
370 int /* provider_id */,
371 base::string16 /* message */,
372 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
373 std::vector<int> /* new_routing_ids */)
375 // Sent via EmbeddedWorker to dispatch events.
376 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_InstallEvent,
377 int /* request_id */)
378 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent,
379 int /* request_id */)
380 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent,
381 int /* request_id */,
382 content::ServiceWorkerFetchRequest)
383 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_SyncEvent,
384 int /* request_id */)
385 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_NotificationClickEvent,
386 int /* request_id */,
387 std::string /* notification_id */,
388 content::PlatformNotificationData /* notification_data */)
389 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_PushEvent,
390 int /* request_id */,
391 std::string /* data */)
392 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_GeofencingEvent,
393 int /* request_id */,
394 blink::WebGeofencingEventType /* event_type */,
395 std::string /* region_id */,
396 blink::WebCircularGeofencingRegion /* region */)
397 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_CrossOriginConnectEvent,
398 int /* request_id */,
399 content::NavigatorConnectClient /* client */)
400 IPC_MESSAGE_CONTROL3(
401 ServiceWorkerMsg_MessageToWorker,
402 base::string16 /* message */,
403 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
404 std::vector<int> /* new_routing_ids */)
405 IPC_MESSAGE_CONTROL4(
406 ServiceWorkerMsg_CrossOriginMessageToWorker,
407 content::NavigatorConnectClient /* client */,
408 base::string16 /* message */,
409 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
410 std::vector<int> /* new_routing_ids */)
411 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_DidSkipWaiting,
412 int /* request_id */)
413 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_DidClaimClients,
414 int /* request_id */)
415 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ClaimClientsError,
416 int /* request_id */,
417 blink::WebServiceWorkerError::ErrorType /* code */,
418 base::string16 /* message */)
420 // Sent via EmbeddedWorker to Ping the worker, expecting a Pong in response.
421 IPC_MESSAGE_CONTROL0(ServiceWorkerMsg_Ping)
423 // Sent via EmbeddedWorker as a response of GetClients.
424 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DidGetClients,
425 int /* request_id */,
426 std::vector<content::ServiceWorkerClientInfo>)
428 // Sent via EmbeddedWorker as a response of OpenWindow.
429 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_OpenWindowResponse,
430 int /* request_id */,
431 content::ServiceWorkerClientInfo /* client */)
433 // Sent via EmbeddedWorker as an error response of OpenWindow.
434 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_OpenWindowError,
435 int /* request_id */,
436 std::string /* message */ )
438 // Sent via EmbeddedWorker as a response of FocusClient.
439 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FocusClientResponse,
440 int /* request_id */,
441 content::ServiceWorkerClientInfo /* client */)