Enable gesture editing visibile in options menu.
[chromium-blink-merge.git] / content / common / service_worker / service_worker_messages.h
blobd18bef7f3d7cbb74e02b505714d78832b73ba906
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_ROUTED2(ServiceWorkerHostMsg_SyncEventFinished,
203 int /* request_id */,
204 blink::WebServiceWorkerEventResult)
205 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_NotificationClickEventFinished,
206 int /* request_id */)
207 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_PushEventFinished,
208 int /* request_id */,
209 blink::WebServiceWorkerEventResult)
210 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_GeofencingEventFinished,
211 int /* request_id */)
212 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_CrossOriginConnectEventFinished,
213 int /* request_id */,
214 bool /* accept_connection */)
216 // Responds to a Ping from the browser.
217 // Routed to the target ServiceWorkerVersion.
218 IPC_MESSAGE_ROUTED0(ServiceWorkerHostMsg_Pong)
220 // Asks the browser to retrieve clients of the sender ServiceWorker.
221 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_GetClients,
222 int /* request_id */,
223 content::ServiceWorkerClientQueryOptions)
225 // Sends a 'message' event to a client (renderer->browser).
226 IPC_MESSAGE_ROUTED3(
227 ServiceWorkerHostMsg_PostMessageToClient,
228 std::string /* uuid */,
229 base::string16 /* message */,
230 std::vector<content::TransferredMessagePort> /* sent_message_ports */)
232 // ServiceWorker -> Browser message to request that the ServiceWorkerStorage
233 // cache |data| associated with |url|.
234 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_SetCachedMetadata,
235 GURL /* url */,
236 std::vector<char> /* data */)
238 // ServiceWorker -> Browser message to request that the ServiceWorkerStorage
239 // clear the cache associated with |url|.
240 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_ClearCachedMetadata, GURL /* url */)
242 // Ask the browser to open a tab/window (renderer->browser).
243 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_OpenWindow,
244 int /* request_id */,
245 GURL /* url */)
247 // Ask the browser to focus a client (renderer->browser).
248 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_FocusClient,
249 int /* request_id */,
250 std::string /* uuid */)
252 // Asks the browser to force this worker to become activated.
253 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_SkipWaiting,
254 int /* request_id */)
256 // Asks the browser to have this worker take control of pages that match
257 // its scope.
258 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_ClaimClients,
259 int /* request_id */)
261 // Asks the browser to stash a message port, giving it a name.
262 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_StashMessagePort,
263 int /* message_port_id */,
264 base::string16 /* name */)
266 //---------------------------------------------------------------------------
267 // Messages sent from the browser to the child process.
269 // NOTE: All ServiceWorkerMsg messages not sent via EmbeddedWorker must have
270 // a thread_id as their first field so that ServiceWorkerMessageFilter can
271 // extract it and dispatch the message to the correct ServiceWorkerDispatcher
272 // on the correct thread.
274 // Informs the child process of the registration associated with the service
275 // worker.
276 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_AssociateRegistrationWithServiceWorker,
277 int /* thread_id*/,
278 int /* provider_id */,
279 content::ServiceWorkerRegistrationObjectInfo,
280 content::ServiceWorkerVersionAttributes)
282 // Informs the child process that the given provider gets associated or
283 // disassociated with the registration.
284 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_AssociateRegistration,
285 int /* thread_id */,
286 int /* provider_id */,
287 content::ServiceWorkerRegistrationObjectInfo,
288 content::ServiceWorkerVersionAttributes)
289 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DisassociateRegistration,
290 int /* thread_id */,
291 int /* provider_id */)
293 // Response to ServiceWorkerHostMsg_RegisterServiceWorker.
294 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistered,
295 int /* thread_id */,
296 int /* request_id */,
297 content::ServiceWorkerRegistrationObjectInfo,
298 content::ServiceWorkerVersionAttributes)
300 // Response to ServiceWorkerHostMsg_UnregisterServiceWorker.
301 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerUnregistered,
302 int /* thread_id */,
303 int /* request_id */,
304 bool /* is_success */)
306 // Response to ServiceWorkerHostMsg_GetRegistration.
307 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_DidGetRegistration,
308 int /* thread_id */,
309 int /* request_id */,
310 content::ServiceWorkerRegistrationObjectInfo,
311 content::ServiceWorkerVersionAttributes)
313 // Response to ServiceWorkerHostMsg_GetRegistrationForReady.
314 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_DidGetRegistrationForReady,
315 int /* thread_id */,
316 int /* request_id */,
317 content::ServiceWorkerRegistrationObjectInfo,
318 content::ServiceWorkerVersionAttributes)
320 // Sent when any kind of registration error occurs during a
321 // RegisterServiceWorker handler above.
322 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
323 int /* thread_id */,
324 int /* request_id */,
325 blink::WebServiceWorkerError::ErrorType /* code */,
326 base::string16 /* message */)
328 // Sent when any kind of registration error occurs during a
329 // UnregisterServiceWorker handler above.
330 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerUnregistrationError,
331 int /* thread_id */,
332 int /* request_id */,
333 blink::WebServiceWorkerError::ErrorType /* code */,
334 base::string16 /* message */)
336 // Sent when any kind of registration error occurs during a
337 // GetRegistration handler above.
338 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerGetRegistrationError,
339 int /* thread_id */,
340 int /* request_id */,
341 blink::WebServiceWorkerError::ErrorType /* code */,
342 base::string16 /* message */)
344 // Informs the child process that the ServiceWorker's state has changed.
345 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerStateChanged,
346 int /* thread_id */,
347 int /* handle_id */,
348 blink::WebServiceWorkerState)
350 // Tells the child process to set service workers for the given provider.
351 IPC_MESSAGE_CONTROL5(ServiceWorkerMsg_SetVersionAttributes,
352 int /* thread_id */,
353 int /* provider_id */,
354 int /* registration_handle_id */,
355 int /* changed_mask */,
356 content::ServiceWorkerVersionAttributes)
358 // Informs the child process that new ServiceWorker enters the installation
359 // phase.
360 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_UpdateFound,
361 int /* thread_id */,
362 int /* registration_handle_id */)
364 // Tells the child process to set the controller ServiceWorker for the given
365 // provider.
366 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_SetControllerServiceWorker,
367 int /* thread_id */,
368 int /* provider_id */,
369 content::ServiceWorkerObjectInfo,
370 bool /* should_notify_controllerchange */)
372 // Sends a 'message' event to a client document (browser->renderer).
373 IPC_MESSAGE_CONTROL5(
374 ServiceWorkerMsg_MessageToDocument,
375 int /* thread_id */,
376 int /* provider_id */,
377 base::string16 /* message */,
378 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
379 std::vector<int> /* new_routing_ids */)
381 // Sent via EmbeddedWorker to dispatch events.
382 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_InstallEvent,
383 int /* request_id */)
384 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent,
385 int /* request_id */)
386 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent,
387 int /* request_id */,
388 content::ServiceWorkerFetchRequest)
389 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_SyncEvent,
390 int /* request_id */)
391 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_NotificationClickEvent,
392 int /* request_id */,
393 int64_t /* persistent_notification_id */,
394 content::PlatformNotificationData /* notification_data */)
395 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_PushEvent,
396 int /* request_id */,
397 std::string /* data */)
398 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_GeofencingEvent,
399 int /* request_id */,
400 blink::WebGeofencingEventType /* event_type */,
401 std::string /* region_id */,
402 blink::WebCircularGeofencingRegion /* region */)
403 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_CrossOriginConnectEvent,
404 int /* request_id */,
405 content::NavigatorConnectClient /* client */)
406 IPC_MESSAGE_CONTROL3(
407 ServiceWorkerMsg_MessageToWorker,
408 base::string16 /* message */,
409 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
410 std::vector<int> /* new_routing_ids */)
411 IPC_MESSAGE_CONTROL4(
412 ServiceWorkerMsg_CrossOriginMessageToWorker,
413 content::NavigatorConnectClient /* client */,
414 base::string16 /* message */,
415 std::vector<content::TransferredMessagePort> /* sent_message_ports */,
416 std::vector<int> /* new_routing_ids */)
417 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_DidSkipWaiting,
418 int /* request_id */)
419 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_DidClaimClients,
420 int /* request_id */)
421 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ClaimClientsError,
422 int /* request_id */,
423 blink::WebServiceWorkerError::ErrorType /* code */,
424 base::string16 /* message */)
426 // Sent via EmbeddedWorker to Ping the worker, expecting a Pong in response.
427 IPC_MESSAGE_CONTROL0(ServiceWorkerMsg_Ping)
429 // Sent via EmbeddedWorker as a response of GetClients.
430 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DidGetClients,
431 int /* request_id */,
432 std::vector<content::ServiceWorkerClientInfo>)
434 // Sent via EmbeddedWorker as a response of OpenWindow.
435 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_OpenWindowResponse,
436 int /* request_id */,
437 content::ServiceWorkerClientInfo /* client */)
439 // Sent via EmbeddedWorker as an error response of OpenWindow.
440 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_OpenWindowError,
441 int /* request_id */,
442 std::string /* message */ )
444 // Sent via EmbeddedWorker as a response of FocusClient.
445 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FocusClientResponse,
446 int /* request_id */,
447 content::ServiceWorkerClientInfo /* client */)
449 // Sent via EmbeddedWorker to transfer a stashed message port to the worker.
450 IPC_MESSAGE_CONTROL3(
451 ServiceWorkerMsg_SendStashedMessagePorts,
452 std::vector<content::TransferredMessagePort> /* stashed_message_ports */,
453 std::vector<int> /* new_routing_ids */,
454 std::vector<base::string16> /* port_names */)