[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / content / common / service_worker / service_worker_messages.h
blob8a1d8cdff2e40cceac3f60cbe67f3f7531db210e
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(referrer)
35 IPC_STRUCT_TRAITS_MEMBER(is_reload)
36 IPC_STRUCT_TRAITS_END()
38 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerFetchEventResult,
39 content::SERVICE_WORKER_FETCH_EVENT_LAST)
41 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerResponse)
42 IPC_STRUCT_TRAITS_MEMBER(status_code)
43 IPC_STRUCT_TRAITS_MEMBER(status_text)
44 IPC_STRUCT_TRAITS_MEMBER(headers)
45 IPC_STRUCT_TRAITS_MEMBER(blob_uuid)
46 IPC_STRUCT_TRAITS_END()
48 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerObjectInfo)
49 IPC_STRUCT_TRAITS_MEMBER(handle_id)
50 IPC_STRUCT_TRAITS_MEMBER(scope)
51 IPC_STRUCT_TRAITS_MEMBER(url)
52 IPC_STRUCT_TRAITS_MEMBER(state)
53 IPC_STRUCT_TRAITS_END()
55 //---------------------------------------------------------------------------
56 // Messages sent from the child process to the browser.
58 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_RegisterServiceWorker,
59 int /* thread_id */,
60 int /* request_id */,
61 int /* provider_id */,
62 GURL /* scope */,
63 GURL /* script_url */)
65 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_UnregisterServiceWorker,
66 int /* thread_id */,
67 int /* request_id */,
68 int /* provider_id */,
69 GURL /* scope (url pattern) */)
71 // Sends a 'message' event to a service worker (renderer->browser).
72 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_PostMessageToWorker,
73 int /* handle_id */,
74 base::string16 /* message */,
75 std::vector<int> /* sent_message_port_ids */)
77 // Informs the browser of a new ServiceWorkerProvider in the child process,
78 // |provider_id| is unique within its child process.
79 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated,
80 int /* provider_id */)
82 // Informs the browser of a ServiceWorkerProvider being destroyed.
83 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed,
84 int /* provider_id */)
86 // Increments and decrements the ServiceWorker object's reference
87 // counting in the browser side. The ServiceWorker object is created
88 // with ref-count==1 initially.
89 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_IncrementServiceWorkerRefCount,
90 int /* handle_id */)
91 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_DecrementServiceWorkerRefCount,
92 int /* handle_id */)
94 // Informs the browser that |provider_id| is associated
95 // with a service worker script running context and
96 // |version_id| identifies which ServcieWorkerVersion.
97 IPC_MESSAGE_CONTROL2(ServiceWorkerHostMsg_SetVersionId,
98 int /* provider_id */,
99 int64 /* version_id */)
101 // Informs the browser that event handling has finished.
102 // Routed to the target ServiceWorkerVersion.
103 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_InstallEventFinished,
104 int /* request_id */,
105 blink::WebServiceWorkerEventResult)
106 IPC_MESSAGE_ROUTED2(ServiceWorkerHostMsg_ActivateEventFinished,
107 int /* request_id */,
108 blink::WebServiceWorkerEventResult)
109 IPC_MESSAGE_ROUTED3(ServiceWorkerHostMsg_FetchEventFinished,
110 int /* request_id */,
111 content::ServiceWorkerFetchEventResult,
112 content::ServiceWorkerResponse)
113 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_SyncEventFinished,
114 int /* request_id */)
115 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_PushEventFinished,
116 int /* request_id */)
118 // Asks the browser to retrieve documents controlled by the sender
119 // ServiceWorker.
120 IPC_MESSAGE_ROUTED1(ServiceWorkerHostMsg_GetClientDocuments,
121 int /* request_id */)
123 // Sends a 'message' event to a client document (renderer->browser).
124 IPC_MESSAGE_ROUTED3(ServiceWorkerHostMsg_PostMessageToDocument,
125 int /* client_id */,
126 base::string16 /* message */,
127 std::vector<int> /* sent_message_port_ids */)
129 //---------------------------------------------------------------------------
130 // Messages sent from the browser to the child process.
132 // NOTE: All ServiceWorkerMsg messages not sent via EmbeddedWorker must have
133 // a thread_id as their first field so that ServiceWorkerMessageFilter can
134 // extract it and dispatch the message to the correct ServiceWorkerDispatcher
135 // on the correct thread.
137 // Response to ServiceWorkerMsg_RegisterServiceWorker.
138 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerRegistered,
139 int /* thread_id */,
140 int /* request_id */,
141 content::ServiceWorkerObjectInfo)
143 // Response to ServiceWorkerMsg_UnregisterServiceWorker.
144 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_ServiceWorkerUnregistered,
145 int /* thread_id */,
146 int /* request_id */)
148 // Sent when any kind of registration error occurs during a
149 // RegisterServiceWorker / UnregisterServiceWorker handler above.
150 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
151 int /* thread_id */,
152 int /* request_id */,
153 blink::WebServiceWorkerError::ErrorType /* code */,
154 base::string16 /* message */)
156 // Informs the child process that the ServiceWorker's state has changed.
157 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerStateChanged,
158 int /* thread_id */,
159 int /* handle_id */,
160 blink::WebServiceWorkerState)
162 // Tells the child process to set the installing ServiceWorker for the given
163 // provider.
164 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetInstallingServiceWorker,
165 int /* thread_id */,
166 int /* provider_id */,
167 content::ServiceWorkerObjectInfo)
169 // Tells the child process to set the waiting ServiceWorker for the given
170 // provider.
171 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetWaitingServiceWorker,
172 int /* thread_id */,
173 int /* provider_id */,
174 content::ServiceWorkerObjectInfo)
176 // Tells the child process to set the active ServiceWorker for the given
177 // provider.
178 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetActiveServiceWorker,
179 int /* thread_id */,
180 int /* provider_id */,
181 content::ServiceWorkerObjectInfo)
183 // Tells the child process to set the controller ServiceWorker for the given
184 // provider.
185 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_SetControllerServiceWorker,
186 int /* thread_id */,
187 int /* provider_id */,
188 content::ServiceWorkerObjectInfo)
190 // Sends a 'message' event to a client document (browser->renderer).
191 IPC_MESSAGE_CONTROL5(ServiceWorkerMsg_MessageToDocument,
192 int /* thread_id */,
193 int /* provider_id */,
194 base::string16 /* message */,
195 std::vector<int> /* sent_message_port_ids */,
196 std::vector<int> /* new_routing_ids */)
198 // Sent via EmbeddedWorker to dispatch events.
199 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_InstallEvent,
200 int /* request_id */,
201 int /* active_version_id */)
202 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_ActivateEvent,
203 int /* request_id */)
204 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_FetchEvent,
205 int /* request_id */,
206 content::ServiceWorkerFetchRequest)
207 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_SyncEvent,
208 int /* request_id */)
209 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_PushEvent,
210 int /* request_id */,
211 std::string /* data */)
212 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_MessageToWorker,
213 base::string16 /* message */,
214 std::vector<int> /* sent_message_port_ids */,
215 std::vector<int> /* new_routing_ids */)
217 // Sent via EmbeddedWorker as a response of GetClientDocuments.
218 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DidGetClientDocuments,
219 int /* request_id */,
220 std::vector<int> /* client_ids */)