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 27 matching lines...) Expand all Loading... |
38 class StoragePartitionImpl; | 38 class StoragePartitionImpl; |
39 | 39 |
40 // A refcounted wrapper class for our core object. Higher level content lib | 40 // A refcounted wrapper class for our core object. Higher level content lib |
41 // classes keep references to this class on mutliple threads. The inner core | 41 // classes keep references to this class on mutliple threads. The inner core |
42 // instance is strictly single threaded and is not refcounted, the core object | 42 // instance is strictly single threaded and is not refcounted, the core object |
43 // is what is used internally in the service worker lib. | 43 // is what is used internally in the service worker lib. |
44 class CONTENT_EXPORT ServiceWorkerContextWrapper | 44 class CONTENT_EXPORT ServiceWorkerContextWrapper |
45 : NON_EXPORTED_BASE(public ServiceWorkerContext), | 45 : NON_EXPORTED_BASE(public ServiceWorkerContext), |
46 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { | 46 public base::RefCountedThreadSafe<ServiceWorkerContextWrapper> { |
47 public: | 47 public: |
| 48 typedef base::Callback<void(ServiceWorkerStatusCode)> StatusCallback; |
48 ServiceWorkerContextWrapper(BrowserContext* browser_context); | 49 ServiceWorkerContextWrapper(BrowserContext* browser_context); |
49 | 50 |
50 // Init and Shutdown are for use on the UI thread when the profile, | 51 // Init and Shutdown are for use on the UI thread when the profile, |
51 // storagepartition is being setup and torn down. | 52 // storagepartition is being setup and torn down. |
52 void Init(const base::FilePath& user_data_directory, | 53 void Init(const base::FilePath& user_data_directory, |
53 storage::QuotaManagerProxy* quota_manager_proxy, | 54 storage::QuotaManagerProxy* quota_manager_proxy, |
54 storage::SpecialStoragePolicy* special_storage_policy); | 55 storage::SpecialStoragePolicy* special_storage_policy); |
55 void Shutdown(); | 56 void Shutdown(); |
56 | 57 |
57 // Deletes all files on disk and restarts the system asynchronously. This | 58 // Deletes all files on disk and restarts the system asynchronously. This |
(...skipping 30 matching lines...) Expand all Loading... |
88 void CheckHasServiceWorker( | 89 void CheckHasServiceWorker( |
89 const GURL& url, | 90 const GURL& url, |
90 const GURL& other_url, | 91 const GURL& other_url, |
91 const CheckHasServiceWorkerCallback& callback) override; | 92 const CheckHasServiceWorkerCallback& callback) override; |
92 | 93 |
93 // DeleteForOrigin with completion callback. Does not exit early, and returns | 94 // DeleteForOrigin with completion callback. Does not exit early, and returns |
94 // false if one or more of the deletions fail. | 95 // false if one or more of the deletions fail. |
95 virtual void DeleteForOrigin(const GURL& origin_url, | 96 virtual void DeleteForOrigin(const GURL& origin_url, |
96 const ResultCallback& done); | 97 const ResultCallback& done); |
97 | 98 |
| 99 void StartServiceWorker(const GURL& pattern, const StatusCallback& callback); |
98 void AddObserver(ServiceWorkerContextObserver* observer); | 100 void AddObserver(ServiceWorkerContextObserver* observer); |
99 void RemoveObserver(ServiceWorkerContextObserver* observer); | 101 void RemoveObserver(ServiceWorkerContextObserver* observer); |
100 | 102 |
101 bool is_incognito() const { return is_incognito_; } | 103 bool is_incognito() const { return is_incognito_; } |
102 | 104 |
103 // The URLRequestContext doesn't exist until after the StoragePartition is | 105 // The URLRequestContext doesn't exist until after the StoragePartition is |
104 // made (which is after this object is made). This function must be called | 106 // made (which is after this object is made). This function must be called |
105 // after this object is created but before any ServiceWorkerCache operations. | 107 // after this object is created but before any ServiceWorkerCache operations. |
106 // It must be called on the IO thread. If either parameter is NULL the | 108 // It must be called on the IO thread. If either parameter is NULL the |
107 // function immediately returns without forwarding to the | 109 // function immediately returns without forwarding to the |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // Initialized in Init(); true if the user data directory is empty. | 150 // Initialized in Init(); true if the user data directory is empty. |
149 bool is_incognito_; | 151 bool is_incognito_; |
150 | 152 |
151 // Raw pointer to the StoragePartitionImpl owning |this|. | 153 // Raw pointer to the StoragePartitionImpl owning |this|. |
152 StoragePartitionImpl* storage_partition_; | 154 StoragePartitionImpl* storage_partition_; |
153 }; | 155 }; |
154 | 156 |
155 } // namespace content | 157 } // namespace content |
156 | 158 |
157 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 159 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |