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/cache_storage/cache_storage_types.h"
12 #include "content/common/service_worker/service_worker_types.h"
13 #include "ipc/ipc_message_macros.h"
14 #include "ipc/ipc_param_traits.h"
15 #include "third_party/WebKit/public/platform/WebServiceWorkerCacheError.h"
18 #undef IPC_MESSAGE_EXPORT
19 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
21 #define IPC_MESSAGE_START CacheStorageMsgStart
23 // TODO(jsbell): This depends on traits for content::ServiceWorkerResponse
24 // which are defined in service_worker_messages.h - correct this implicit
27 IPC_STRUCT_TRAITS_BEGIN(content::CacheStorageCacheQueryParams
)
28 IPC_STRUCT_TRAITS_MEMBER(ignore_search
)
29 IPC_STRUCT_TRAITS_MEMBER(ignore_method
)
30 IPC_STRUCT_TRAITS_MEMBER(ignore_vary
)
31 IPC_STRUCT_TRAITS_MEMBER(cache_name
)
32 IPC_STRUCT_TRAITS_END()
34 IPC_ENUM_TRAITS_MAX_VALUE(content::CacheStorageCacheOperationType
,
35 content::CACHE_STORAGE_CACHE_OPERATION_TYPE_LAST
)
37 IPC_STRUCT_TRAITS_BEGIN(content::CacheStorageBatchOperation
)
38 IPC_STRUCT_TRAITS_MEMBER(operation_type
)
39 IPC_STRUCT_TRAITS_MEMBER(request
)
40 IPC_STRUCT_TRAITS_MEMBER(response
)
41 IPC_STRUCT_TRAITS_MEMBER(match_params
)
42 IPC_STRUCT_TRAITS_END()
44 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerCacheError
,
45 blink::WebServiceWorkerCacheErrorLast
)
47 //---------------------------------------------------------------------------
48 // Messages sent from the child process to the browser.
50 // CacheStorage operations in the browser.
51 IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageHas
,
55 base::string16
/* fetch_store_name */)
57 IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageOpen
,
61 base::string16
/* fetch_store_name */)
63 IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheStorageDelete
,
67 base::string16
/* fetch_store_name */)
69 IPC_MESSAGE_CONTROL3(CacheStorageHostMsg_CacheStorageKeys
,
74 IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheStorageMatch
,
78 content::ServiceWorkerFetchRequest
,
79 content::CacheStorageCacheQueryParams
)
81 // Cache operations in the browser.
82 IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheMatch
,
86 content::ServiceWorkerFetchRequest
,
87 content::CacheStorageCacheQueryParams
)
89 IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheMatchAll
,
93 content::ServiceWorkerFetchRequest
,
94 content::CacheStorageCacheQueryParams
)
96 IPC_MESSAGE_CONTROL5(CacheStorageHostMsg_CacheKeys
,
100 content::ServiceWorkerFetchRequest
,
101 content::CacheStorageCacheQueryParams
)
103 IPC_MESSAGE_CONTROL4(CacheStorageHostMsg_CacheBatch
,
105 int /* request_id */,
107 std::vector
<content::CacheStorageBatchOperation
>)
109 IPC_MESSAGE_CONTROL1(CacheStorageHostMsg_CacheClosed
,
112 IPC_MESSAGE_CONTROL1(CacheStorageHostMsg_BlobDataHandled
,
113 std::string
/* uuid */)
115 //---------------------------------------------------------------------------
116 // Messages sent from the browser to the child process.
118 // All such messages must includes thread_id as the first int; it is read off
119 // by CacheStorageMessageFilter::GetWorkerThreadIdForMessage to route delivery
120 // to the appropriate thread.
122 // Sent at successful completion of CacheStorage operations.
123 IPC_MESSAGE_CONTROL2(CacheStorageMsg_CacheStorageHasSuccess
,
125 int /* request_id */)
126 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageOpenSuccess
,
128 int /* request_id */,
129 int /* fetch_store_id */)
130 IPC_MESSAGE_CONTROL2(CacheStorageMsg_CacheStorageDeleteSuccess
,
132 int /* request_id */)
133 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageKeysSuccess
,
135 int /* request_id */,
136 std::vector
<base::string16
> /* keys */)
137 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageMatchSuccess
,
139 int /* request_id */,
140 content::ServiceWorkerResponse
)
142 // Sent at erroneous completion of CacheStorage operations.
143 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageHasError
,
145 int /* request_id */,
146 blink::WebServiceWorkerCacheError
/* reason */)
147 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageOpenError
,
149 int /* request_id */,
150 blink::WebServiceWorkerCacheError
/* reason */)
151 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageDeleteError
,
153 int /* request_id */,
154 blink::WebServiceWorkerCacheError
/* reason */)
155 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageKeysError
,
157 int /* request_id */,
158 blink::WebServiceWorkerCacheError
/* reason */)
159 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheStorageMatchError
,
161 int /* request_id */,
162 blink::WebServiceWorkerCacheError
)
164 // Sent at successful completion of Cache operations.
165 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchSuccess
,
167 int /* request_id */,
168 content::ServiceWorkerResponse
)
169 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchAllSuccess
,
171 int /* request_id */,
172 std::vector
<content::ServiceWorkerResponse
>)
173 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheKeysSuccess
,
175 int /* request_id */,
176 std::vector
<content::ServiceWorkerFetchRequest
>)
177 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheBatchSuccess
,
179 int /* request_id */,
180 std::vector
<content::ServiceWorkerResponse
>)
182 // Sent at erroneous completion of CacheStorage operations.
183 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchError
,
185 int /* request_id */,
186 blink::WebServiceWorkerCacheError
)
187 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheMatchAllError
,
189 int /* request_id */,
190 blink::WebServiceWorkerCacheError
)
191 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheKeysError
,
193 int /* request_id */,
194 blink::WebServiceWorkerCacheError
)
195 IPC_MESSAGE_CONTROL3(CacheStorageMsg_CacheBatchError
,
197 int /* request_id */,
198 blink::WebServiceWorkerCacheError
)