OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "content/browser/service_worker/service_worker_context_core.h" | 17 #include "content/browser/service_worker/service_worker_context_core.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/public/browser/service_worker_context.h" | 19 #include "content/public/browser/service_worker_context.h" |
20 #include "net/url_request/url_request_context_getter_observer.h" | 20 #include "net/url_request/url_request_context_getter_observer.h" |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class FilePath; | 23 class FilePath; |
24 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
25 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
26 } | 26 } |
27 | 27 |
| 28 namespace blink { |
| 29 enum class WebNavigationHintType; |
| 30 } |
| 31 |
28 namespace storage { | 32 namespace storage { |
29 class QuotaManagerProxy; | 33 class QuotaManagerProxy; |
30 class SpecialStoragePolicy; | 34 class SpecialStoragePolicy; |
31 } | 35 } |
32 | 36 |
33 namespace content { | 37 namespace content { |
34 | 38 |
35 class BrowserContext; | 39 class BrowserContext; |
36 class ResourceContext; | 40 class ResourceContext; |
37 class ServiceWorkerContextCore; | 41 class ServiceWorkerContextCore; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const ResultCallback& continuation) override; | 107 const ResultCallback& continuation) override; |
104 void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; | 108 void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; |
105 void DeleteForOrigin(const GURL& origin, | 109 void DeleteForOrigin(const GURL& origin, |
106 const ResultCallback& callback) override; | 110 const ResultCallback& callback) override; |
107 void CheckHasServiceWorker( | 111 void CheckHasServiceWorker( |
108 const GURL& url, | 112 const GURL& url, |
109 const GURL& other_url, | 113 const GURL& other_url, |
110 const CheckHasServiceWorkerCallback& callback) override; | 114 const CheckHasServiceWorkerCallback& callback) override; |
111 void StopAllServiceWorkersForOrigin(const GURL& origin) override; | 115 void StopAllServiceWorkersForOrigin(const GURL& origin) override; |
112 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; | 116 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; |
| 117 void StartServiceWorkerForNavigationHint( |
| 118 const GURL& document_url, |
| 119 blink::WebNavigationHintType type, |
| 120 int render_process_id, |
| 121 const ResultCallback& callback) override; |
113 | 122 |
114 // These methods must only be called from the IO thread. | 123 // These methods must only be called from the IO thread. |
115 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); | 124 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); |
116 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); | 125 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); |
117 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); | 126 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); |
118 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); | 127 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); |
119 | 128 |
120 // Must be called from the IO thread. | 129 // Must be called from the IO thread. |
121 void HasMainFrameProviderHost(const GURL& origin, | 130 void HasMainFrameProviderHost(const GURL& origin, |
122 const BoolCallback& callback) const; | 131 const BoolCallback& callback) const; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 ServiceWorkerStatusCode status, | 233 ServiceWorkerStatusCode status, |
225 const std::vector<ServiceWorkerRegistrationInfo>& registrations); | 234 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
226 | 235 |
227 void DidCheckHasServiceWorker(const CheckHasServiceWorkerCallback& callback, | 236 void DidCheckHasServiceWorker(const CheckHasServiceWorkerCallback& callback, |
228 bool has_service_worker); | 237 bool has_service_worker); |
229 | 238 |
230 void DidFindRegistrationForUpdate( | 239 void DidFindRegistrationForUpdate( |
231 ServiceWorkerStatusCode status, | 240 ServiceWorkerStatusCode status, |
232 scoped_refptr<content::ServiceWorkerRegistration> registration); | 241 scoped_refptr<content::ServiceWorkerRegistration> registration); |
233 | 242 |
| 243 void DidCheckRenderProcessForNavigationHint(const GURL& document_url, |
| 244 blink::WebNavigationHintType type, |
| 245 int render_process_id, |
| 246 const ResultCallback& callback); |
| 247 |
| 248 void DidFindRegistrationForNavigationHint( |
| 249 blink::WebNavigationHintType type, |
| 250 int render_process_id, |
| 251 const ResultCallback& callback, |
| 252 ServiceWorkerStatusCode status, |
| 253 scoped_refptr<ServiceWorkerRegistration> registration); |
| 254 |
| 255 void DidStartServiceWorkerForNavigationHint(const GURL& pattern, |
| 256 int render_process_id, |
| 257 const ResultCallback& callback, |
| 258 ServiceWorkerStatusCode code); |
| 259 |
234 // The core context is only for use on the IO thread. | 260 // The core context is only for use on the IO thread. |
235 // Can be null before/during init, during/after shutdown, and after | 261 // Can be null before/during init, during/after shutdown, and after |
236 // DeleteAndStartOver fails. | 262 // DeleteAndStartOver fails. |
237 ServiceWorkerContextCore* context(); | 263 ServiceWorkerContextCore* context(); |
238 | 264 |
239 const scoped_refptr<base::ObserverListThreadSafe< | 265 const scoped_refptr<base::ObserverListThreadSafe< |
240 ServiceWorkerContextObserver>> observer_list_; | 266 ServiceWorkerContextObserver>> observer_list_; |
241 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; | 267 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; |
242 // Cleared in ShutdownOnIO(): | 268 // Cleared in ShutdownOnIO(): |
243 std::unique_ptr<ServiceWorkerContextCore> context_core_; | 269 std::unique_ptr<ServiceWorkerContextCore> context_core_; |
244 | 270 |
245 // Initialized in Init(); true if the user data directory is empty. | 271 // Initialized in Init(); true if the user data directory is empty. |
246 bool is_incognito_; | 272 bool is_incognito_; |
247 | 273 |
248 // Raw pointer to the StoragePartitionImpl owning |this|. | 274 // Raw pointer to the StoragePartitionImpl owning |this|. |
249 StoragePartitionImpl* storage_partition_; | 275 StoragePartitionImpl* storage_partition_; |
250 | 276 |
251 // The ResourceContext associated with this context. | 277 // The ResourceContext associated with this context. |
252 ResourceContext* resource_context_; | 278 ResourceContext* resource_context_; |
253 | 279 |
254 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 280 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
255 | 281 |
256 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 282 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
257 }; | 283 }; |
258 | 284 |
259 } // namespace content | 285 } // namespace content |
260 | 286 |
261 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 287 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |