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"
15 #undef IPC_MESSAGE_EXPORT
16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
18 #define IPC_MESSAGE_START ServiceWorkerMsgStart
20 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerError::ErrorType,
21 blink::WebServiceWorkerError::ErrorTypeLast)
23 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerFetchRequest)
24 IPC_STRUCT_TRAITS_MEMBER(url)
25 IPC_STRUCT_TRAITS_MEMBER(method)
26 IPC_STRUCT_TRAITS_MEMBER(headers)
27 IPC_STRUCT_TRAITS_END()
29 // Messages sent from the child process to the browser.
31 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_RegisterServiceWorker,
32 int32 /* thread_id */,
33 int32 /* request_id */,
35 GURL /* script_url */)
37 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_UnregisterServiceWorker,
38 int32 /* thread_id */,
39 int32 /* request_id */,
40 GURL /* scope (url pattern) */)
42 // Messages sent from the browser to the child process.
44 // Response to ServiceWorkerMsg_RegisterServiceWorker
45 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ServiceWorkerRegistered,
46 int32 /* thread_id */,
47 int32 /* request_id */,
48 int64 /* service_worker_id */)
50 // Response to ServiceWorkerMsg_UnregisterServiceWorker
51 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_ServiceWorkerUnregistered,
52 int32 /* thread_id */,
53 int32 /* request_id */)
55 // Sent when any kind of registration error occurs during a
56 // RegisterServiceWorker / UnregisterServiceWorker handler above.
57 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
58 int32 /* thread_id */,
59 int32 /* request_id */,
60 blink::WebServiceWorkerError::ErrorType /* code */,
61 base::string16 /* message */)
63 // Sent via EmbeddedWorker to dispatch install event.
64 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_InstallEvent,
65 int /* active_version_embedded_worker_id */)
67 // Sent via EmbeddedWorker to dispatch fetch event.
68 IPC_MESSAGE_CONTROL1(ServiceWorkerMsg_FetchEvent,
69 content::ServiceWorkerFetchRequest)
71 // Informs the browser of a new ServiceWorkerProvider in the child process,
72 // |provider_id| is unique within its child process.
73 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderCreated,
74 int /* provider_id */)
76 // Informs the browser of a ServiceWorkerProvider being destroyed.
77 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_ProviderDestroyed,
78 int /* provider_id */)
80 // Informs the browser that install event handling has finished.
81 // Sent via EmbeddedWorker. If there was an exception during the
82 // event handling it'll be reported back separately (to be propagated
84 IPC_MESSAGE_CONTROL0(ServiceWorkerHostMsg_InstallEventFinished)