| 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 | |
| 32 namespace storage { | 28 namespace storage { |
| 33 class QuotaManagerProxy; | 29 class QuotaManagerProxy; |
| 34 class SpecialStoragePolicy; | 30 class SpecialStoragePolicy; |
| 35 } | 31 } |
| 36 | 32 |
| 37 namespace content { | 33 namespace content { |
| 38 | 34 |
| 39 class BrowserContext; | 35 class BrowserContext; |
| 40 class ResourceContext; | 36 class ResourceContext; |
| 41 class ServiceWorkerContextCore; | 37 class ServiceWorkerContextCore; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const ResultCallback& continuation) override; | 103 const ResultCallback& continuation) override; |
| 108 void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; | 104 void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; |
| 109 void DeleteForOrigin(const GURL& origin, | 105 void DeleteForOrigin(const GURL& origin, |
| 110 const ResultCallback& callback) override; | 106 const ResultCallback& callback) override; |
| 111 void CheckHasServiceWorker( | 107 void CheckHasServiceWorker( |
| 112 const GURL& url, | 108 const GURL& url, |
| 113 const GURL& other_url, | 109 const GURL& other_url, |
| 114 const CheckHasServiceWorkerCallback& callback) override; | 110 const CheckHasServiceWorkerCallback& callback) override; |
| 115 void StopAllServiceWorkersForOrigin(const GURL& origin) override; | 111 void StopAllServiceWorkersForOrigin(const GURL& origin) override; |
| 116 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; | 112 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; | |
| 122 | 113 |
| 123 // These methods must only be called from the IO thread. | 114 // These methods must only be called from the IO thread. |
| 124 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); | 115 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); |
| 125 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); | 116 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); |
| 126 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); | 117 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); |
| 127 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); | 118 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); |
| 128 | 119 |
| 129 // Must be called from the IO thread. | 120 // Must be called from the IO thread. |
| 130 void HasMainFrameProviderHost(const GURL& origin, | 121 void HasMainFrameProviderHost(const GURL& origin, |
| 131 const BoolCallback& callback) const; | 122 const BoolCallback& callback) const; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 ServiceWorkerStatusCode status, | 224 ServiceWorkerStatusCode status, |
| 234 const std::vector<ServiceWorkerRegistrationInfo>& registrations); | 225 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
| 235 | 226 |
| 236 void DidCheckHasServiceWorker(const CheckHasServiceWorkerCallback& callback, | 227 void DidCheckHasServiceWorker(const CheckHasServiceWorkerCallback& callback, |
| 237 bool has_service_worker); | 228 bool has_service_worker); |
| 238 | 229 |
| 239 void DidFindRegistrationForUpdate( | 230 void DidFindRegistrationForUpdate( |
| 240 ServiceWorkerStatusCode status, | 231 ServiceWorkerStatusCode status, |
| 241 scoped_refptr<content::ServiceWorkerRegistration> registration); | 232 scoped_refptr<content::ServiceWorkerRegistration> registration); |
| 242 | 233 |
| 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 | |
| 260 // The core context is only for use on the IO thread. | 234 // The core context is only for use on the IO thread. |
| 261 // Can be null before/during init, during/after shutdown, and after | 235 // Can be null before/during init, during/after shutdown, and after |
| 262 // DeleteAndStartOver fails. | 236 // DeleteAndStartOver fails. |
| 263 ServiceWorkerContextCore* context(); | 237 ServiceWorkerContextCore* context(); |
| 264 | 238 |
| 265 const scoped_refptr<base::ObserverListThreadSafe< | 239 const scoped_refptr<base::ObserverListThreadSafe< |
| 266 ServiceWorkerContextObserver>> observer_list_; | 240 ServiceWorkerContextObserver>> observer_list_; |
| 267 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; | 241 const std::unique_ptr<ServiceWorkerProcessManager> process_manager_; |
| 268 // Cleared in ShutdownOnIO(): | 242 // Cleared in ShutdownOnIO(): |
| 269 std::unique_ptr<ServiceWorkerContextCore> context_core_; | 243 std::unique_ptr<ServiceWorkerContextCore> context_core_; |
| 270 | 244 |
| 271 // Initialized in Init(); true if the user data directory is empty. | 245 // Initialized in Init(); true if the user data directory is empty. |
| 272 bool is_incognito_; | 246 bool is_incognito_; |
| 273 | 247 |
| 274 // Raw pointer to the StoragePartitionImpl owning |this|. | 248 // Raw pointer to the StoragePartitionImpl owning |this|. |
| 275 StoragePartitionImpl* storage_partition_; | 249 StoragePartitionImpl* storage_partition_; |
| 276 | 250 |
| 277 // The ResourceContext associated with this context. | 251 // The ResourceContext associated with this context. |
| 278 ResourceContext* resource_context_; | 252 ResourceContext* resource_context_; |
| 279 | 253 |
| 280 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 254 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 281 | 255 |
| 282 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 256 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
| 283 }; | 257 }; |
| 284 | 258 |
| 285 } // namespace content | 259 } // namespace content |
| 286 | 260 |
| 287 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 261 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |