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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // A refcounted wrapper class for our core object. Higher level content lib | 36 // A refcounted wrapper class for our core object. Higher level content lib |
37 // classes keep references to this class on mutliple threads. The inner core | 37 // classes keep references to this class on mutliple threads. The inner core |
38 // instance is strictly single threaded and is not refcounted, the core object | 38 // instance is strictly single threaded and is not refcounted, the core object |
39 // is what is used internally in the service worker lib. | 39 // is what is used internally in the service worker lib. |
40 class CONTENT_EXPORT ServiceWorkerContextWrapper | 40 class CONTENT_EXPORT ServiceWorkerContextWrapper |
41 : NON_EXPORTED_BASE(public ServiceWorkerContext), | 41 : NON_EXPORTED_BASE(public ServiceWorkerContext), |
42 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { | 42 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { |
43 public: | 43 public: |
44 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>; | 44 using StatusCallback = base::Callback<void(ServiceWorkerStatusCode)>; |
| 45 using BoolCallback = base::Callback<void(bool)>; |
45 using FindRegistrationCallback = | 46 using FindRegistrationCallback = |
46 ServiceWorkerStorage::FindRegistrationCallback; | 47 ServiceWorkerStorage::FindRegistrationCallback; |
47 using GetRegistrationsInfosCallback = | 48 using GetRegistrationsInfosCallback = |
48 ServiceWorkerStorage::GetRegistrationsInfosCallback; | 49 ServiceWorkerStorage::GetRegistrationsInfosCallback; |
49 using GetUserDataCallback = ServiceWorkerStorage::GetUserDataCallback; | 50 using GetUserDataCallback = ServiceWorkerStorage::GetUserDataCallback; |
50 using GetUserDataForAllRegistrationsCallback = | 51 using GetUserDataForAllRegistrationsCallback = |
51 ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback; | 52 ServiceWorkerStorage::GetUserDataForAllRegistrationsCallback; |
52 | 53 |
53 ServiceWorkerContextWrapper(BrowserContext* browser_context); | 54 ServiceWorkerContextWrapper(BrowserContext* browser_context); |
54 | 55 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 const GURL& other_url, | 97 const GURL& other_url, |
97 const CheckHasServiceWorkerCallback& callback) override; | 98 const CheckHasServiceWorkerCallback& callback) override; |
98 void StopAllServiceWorkersForOrigin(const GURL& origin) override; | 99 void StopAllServiceWorkersForOrigin(const GURL& origin) override; |
99 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; | 100 void ClearAllServiceWorkersForTest(const base::Closure& callback) override; |
100 | 101 |
101 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); | 102 ServiceWorkerRegistration* GetLiveRegistration(int64_t registration_id); |
102 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); | 103 ServiceWorkerVersion* GetLiveVersion(int64_t version_id); |
103 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); | 104 std::vector<ServiceWorkerRegistrationInfo> GetAllLiveRegistrationInfo(); |
104 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); | 105 std::vector<ServiceWorkerVersionInfo> GetAllLiveVersionInfo(); |
105 | 106 |
106 bool HasWindowProviderHost(const GURL& origin) const; | 107 void HasMainFrameProviderHost(const GURL& origin, |
| 108 const BoolCallback& callback) const; |
107 | 109 |
108 // Returns the registration whose scope longest matches |document_url|. | 110 // Returns the registration whose scope longest matches |document_url|. |
109 // Returns ERROR_NOT_FOUND if it is not found. | 111 // Returns ERROR_NOT_FOUND if it is not found. |
110 void FindRegistrationForDocument(const GURL& document_url, | 112 void FindRegistrationForDocument(const GURL& document_url, |
111 const FindRegistrationCallback& callback); | 113 const FindRegistrationCallback& callback); |
112 | 114 |
113 // Returns the registration for |registration_id|. It is guaranteed that the | 115 // Returns the registration for |registration_id|. It is guaranteed that the |
114 // returned registration has the activated worker. | 116 // returned registration has the activated worker. |
115 // | 117 // |
116 // - If the registration is not found, returns ERROR_NOT_FOUND. | 118 // - If the registration is not found, returns ERROR_NOT_FOUND. |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 213 |
212 // The ResourceContext associated with this context. | 214 // The ResourceContext associated with this context. |
213 ResourceContext* resource_context_; | 215 ResourceContext* resource_context_; |
214 | 216 |
215 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 217 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
216 }; | 218 }; |
217 | 219 |
218 } // namespace content | 220 } // namespace content |
219 | 221 |
220 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 222 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |