OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ | 5 #ifndef CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ |
6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ | 6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 | 12 |
| 13 #include "base/callback.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
16 #include "content/common/service_worker/service_worker_client_info.h" | 17 #include "content/common/service_worker/service_worker_client_info.h" |
17 #include "content/public/common/referrer.h" | 18 #include "content/public/common/referrer.h" |
18 #include "content/public/common/request_context_frame_type.h" | 19 #include "content/public/common/request_context_frame_type.h" |
19 #include "content/public/common/request_context_type.h" | 20 #include "content/public/common/request_context_type.h" |
| 21 #include "mojo/public/cpp/bindings/interface_request.h" |
20 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 22 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
21 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientType.h" | 23 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerClientType.h" |
22 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseError.h" | 24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseError.h" |
23 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseType.h" | 25 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponseType.h" |
24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerState.h" | 26 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerState.h" |
25 #include "url/gurl.h" | 27 #include "url/gurl.h" |
26 | 28 |
27 // This file is to have common definitions that are to be shared by | 29 // This file is to have common definitions that are to be shared by |
28 // browser and child process. | 30 // browser and child process. |
29 | 31 |
30 namespace content { | 32 namespace content { |
31 | 33 |
| 34 namespace mojom { |
| 35 class URLLoaderFactory; |
| 36 } // namespace mojom |
| 37 |
32 // Indicates the document main thread ID in the child process. This is used for | 38 // Indicates the document main thread ID in the child process. This is used for |
33 // messaging between the browser process and the child process. | 39 // messaging between the browser process and the child process. |
34 static const int kDocumentMainThreadId = 0; | 40 static const int kDocumentMainThreadId = 0; |
35 | 41 |
36 // Constants for error messages. | 42 // Constants for error messages. |
37 extern const char kServiceWorkerRegisterErrorPrefix[]; | 43 extern const char kServiceWorkerRegisterErrorPrefix[]; |
38 extern const char kServiceWorkerUpdateErrorPrefix[]; | 44 extern const char kServiceWorkerUpdateErrorPrefix[]; |
39 extern const char kServiceWorkerUnregisterErrorPrefix[]; | 45 extern const char kServiceWorkerUnregisterErrorPrefix[]; |
40 extern const char kServiceWorkerGetRegistrationErrorPrefix[]; | 46 extern const char kServiceWorkerGetRegistrationErrorPrefix[]; |
41 extern const char kServiceWorkerGetRegistrationsErrorPrefix[]; | 47 extern const char kServiceWorkerGetRegistrationsErrorPrefix[]; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bool operator()(const std::string& lhs, const std::string& rhs) const { | 135 bool operator()(const std::string& lhs, const std::string& rhs) const { |
130 return base::CompareCaseInsensitiveASCII(lhs, rhs) < 0; | 136 return base::CompareCaseInsensitiveASCII(lhs, rhs) < 0; |
131 } | 137 } |
132 }; | 138 }; |
133 | 139 |
134 using ServiceWorkerHeaderMap = | 140 using ServiceWorkerHeaderMap = |
135 std::map<std::string, std::string, ServiceWorkerCaseInsensitiveCompare>; | 141 std::map<std::string, std::string, ServiceWorkerCaseInsensitiveCompare>; |
136 | 142 |
137 using ServiceWorkerHeaderList = std::vector<std::string>; | 143 using ServiceWorkerHeaderList = std::vector<std::string>; |
138 | 144 |
| 145 // Callback function type to get a mojom::URLLoaderFactory interface by passing |
| 146 // URLLoaderFactoryRequest. |
| 147 using MojoURLLoaderFactoryGetter = |
| 148 base::Callback<void(mojo::InterfaceRequest<mojom::URLLoaderFactory>)>; |
| 149 |
139 // To dispatch fetch request from browser to child process. | 150 // To dispatch fetch request from browser to child process. |
140 struct CONTENT_EXPORT ServiceWorkerFetchRequest { | 151 struct CONTENT_EXPORT ServiceWorkerFetchRequest { |
141 ServiceWorkerFetchRequest(); | 152 ServiceWorkerFetchRequest(); |
142 ServiceWorkerFetchRequest(const GURL& url, | 153 ServiceWorkerFetchRequest(const GURL& url, |
143 const std::string& method, | 154 const std::string& method, |
144 const ServiceWorkerHeaderMap& headers, | 155 const ServiceWorkerHeaderMap& headers, |
145 const Referrer& referrer, | 156 const Referrer& referrer, |
146 bool is_reload); | 157 bool is_reload); |
147 ServiceWorkerFetchRequest(const ServiceWorkerFetchRequest& other); | 158 ServiceWorkerFetchRequest(const ServiceWorkerFetchRequest& other); |
148 ~ServiceWorkerFetchRequest(); | 159 ~ServiceWorkerFetchRequest(); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 const ServiceWorkerObjectInfo& service_worker_info); | 279 const ServiceWorkerObjectInfo& service_worker_info); |
269 | 280 |
270 // Exactly one of these infos should be valid. | 281 // Exactly one of these infos should be valid. |
271 ServiceWorkerClientInfo client_info; | 282 ServiceWorkerClientInfo client_info; |
272 ServiceWorkerObjectInfo service_worker_info; | 283 ServiceWorkerObjectInfo service_worker_info; |
273 }; | 284 }; |
274 | 285 |
275 } // namespace content | 286 } // namespace content |
276 | 287 |
277 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ | 288 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_TYPES_H_ |
OLD | NEW |