1 // Copyright 2015 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.
10 #include "base/strings/string16.h"
11 #include "content/common/service_worker/service_worker_types.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ipc/ipc_param_traits.h"
14 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h"
17 #undef IPC_MESSAGE_EXPORT
18 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
20 #define IPC_MESSAGE_START CacheStorageMsgStart
22 // TODO(jsbell): This depends on traits for content::ServiceWorkerResponse
23 // which are defined in service_worker_messages.h - correct this implicit
26 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerCacheQueryParams
)
27 IPC_STRUCT_TRAITS_MEMBER(ignore_search
)
28 IPC_STRUCT_TRAITS_MEMBER(ignore_method
)
29 IPC_STRUCT_TRAITS_MEMBER(ignore_vary
)
30 IPC_STRUCT_TRAITS_MEMBER(cache_name
)
31 IPC_STRUCT_TRAITS_END()
33 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerCacheOperationType
,
34 content::SERVICE_WORKER_CACHE_OPERATION_TYPE_LAST
)
36 IPC_STRUCT_TRAITS_BEGIN(content::ServiceWorkerBatchOperation
)
37 IPC_STRUCT_TRAITS_MEMBER(operation_type
)
38 IPC_STRUCT_TRAITS_MEMBER(request
)
39 IPC_STRUCT_TRAITS_MEMBER(response
)
40 IPC_STRUCT_TRAITS_MEMBER(match_params
)
41 IPC_STRUCT_TRAITS_END()
43 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerCacheError
,
44 blink::WebServiceWorkerCacheErrorLast
)
46 //---------------------------------------------------------------------------
47 // Messages sent from the child process to the browser.
49 // CacheStorage operations in the browser.
50 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_CacheStorageHas
,
54 base::string16
/* fetch_store_name */)
56 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_CacheStorageOpen
,
60 base::string16
/* fetch_store_name */)
62 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_CacheStorageDelete
,
66 base::string16
/* fetch_store_name */)
68 IPC_MESSAGE_CONTROL3(ServiceWorkerHostMsg_CacheStorageKeys
,
73 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_CacheStorageMatch
,
77 content::ServiceWorkerFetchRequest
,
78 content::ServiceWorkerCacheQueryParams
)
80 // Cache operations in the browser.
81 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_CacheMatch
,
85 content::ServiceWorkerFetchRequest
,
86 content::ServiceWorkerCacheQueryParams
)
88 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_CacheMatchAll
,
92 content::ServiceWorkerFetchRequest
,
93 content::ServiceWorkerCacheQueryParams
)
95 IPC_MESSAGE_CONTROL5(ServiceWorkerHostMsg_CacheKeys
,
99 content::ServiceWorkerFetchRequest
,
100 content::ServiceWorkerCacheQueryParams
)
102 IPC_MESSAGE_CONTROL4(ServiceWorkerHostMsg_CacheBatch
,
104 int /* request_id */,
106 std::vector
<content::ServiceWorkerBatchOperation
>)
108 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_CacheClosed
,
111 IPC_MESSAGE_CONTROL1(ServiceWorkerHostMsg_BlobDataHandled
,
112 std::string
/* uuid */)
114 //---------------------------------------------------------------------------
115 // Messages sent from the browser to the child process.
117 // All such messages must includes thread_id as the first int; it is read off
118 // by CacheStorageMessageFilter::GetWorkerThreadIdForMessage to route delivery
119 // to the appropriate thread.
121 // Sent at successful completion of CacheStorage operations.
122 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_CacheStorageHasSuccess
,
124 int /* request_id */)
125 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageOpenSuccess
,
127 int /* request_id */,
128 int /* fetch_store_id */)
129 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_CacheStorageDeleteSuccess
,
131 int /* request_id */)
132 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageKeysSuccess
,
134 int /* request_id */,
135 std::vector
<base::string16
> /* keys */)
136 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageMatchSuccess
,
138 int /* request_id */,
139 content::ServiceWorkerResponse
)
141 // Sent at erroneous completion of CacheStorage operations.
142 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageHasError
,
144 int /* request_id */,
145 blink::WebServiceWorkerCacheError
/* reason */)
146 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageOpenError
,
148 int /* request_id */,
149 blink::WebServiceWorkerCacheError
/* reason */)
150 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageDeleteError
,
152 int /* request_id */,
153 blink::WebServiceWorkerCacheError
/* reason */)
154 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageKeysError
,
156 int /* request_id */,
157 blink::WebServiceWorkerCacheError
/* reason */)
158 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheStorageMatchError
,
160 int /* request_id */,
161 blink::WebServiceWorkerCacheError
)
163 // Sent at successful completion of Cache operations.
164 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheMatchSuccess
,
166 int /* request_id */,
167 content::ServiceWorkerResponse
)
168 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheMatchAllSuccess
,
170 int /* request_id */,
171 std::vector
<content::ServiceWorkerResponse
>)
172 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheKeysSuccess
,
174 int /* request_id */,
175 std::vector
<content::ServiceWorkerFetchRequest
>)
176 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheBatchSuccess
,
178 int /* request_id */,
179 std::vector
<content::ServiceWorkerResponse
>)
181 // Sent at erroneous completion of CacheStorage operations.
182 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheMatchError
,
184 int /* request_id */,
185 blink::WebServiceWorkerCacheError
)
186 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheMatchAllError
,
188 int /* request_id */,
189 blink::WebServiceWorkerCacheError
)
190 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheKeysError
,
192 int /* request_id */,
193 blink::WebServiceWorkerCacheError
)
194 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_CacheBatchError
,
196 int /* request_id */,
197 blink::WebServiceWorkerCacheError
)