Chromium Code Reviews| Index: content/browser/service_worker/service_worker_context_core.h |
| diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h |
| index 3a629770dc95fedb1770929363b825237a5cb571..a3b70c12525377f50b001ee42a2cf79a20059aca 100644 |
| --- a/content/browser/service_worker/service_worker_context_core.h |
| +++ b/content/browser/service_worker/service_worker_context_core.h |
| @@ -5,10 +5,15 @@ |
| #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
| #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ |
| +#include <map> |
| + |
| +#include "base/callback.h" |
| #include "base/files/file_path.h" |
| #include "base/memory/weak_ptr.h" |
| #include "content/common/content_export.h" |
| +class GURL; |
| + |
| namespace base { |
| class FilePath; |
| } |
| @@ -19,6 +24,9 @@ class QuotaManagerProxy; |
| namespace content { |
| +class ServiceWorkerStorage; |
| +class ServiceWorkerRegistration; |
| + |
| // This class manages data associated with service workers. |
| // The class is single threaded and should only be used on the IO thread. |
| // In chromium, there is one instance per storagepartition. This class |
| @@ -28,16 +36,38 @@ class CONTENT_EXPORT ServiceWorkerContextCore |
| : NON_EXPORTED_BASE( |
| public base::SupportsWeakPtr<ServiceWorkerContextCore>) { |
| public: |
| - // Given an empty |user_data_directory|, nothing will be stored on disk. |
| + typedef base::Callback<void(int64)> ResponseCallback; |
| + |
| + // This is owned by the StoragePartition, which will supply it with |
| + // the local path on disk. Given an empty |user_data_directory|, |
| + // nothing will be stored on disk. |
| ServiceWorkerContextCore(const base::FilePath& user_data_directory, |
| quota::QuotaManagerProxy* quota_manager_proxy); |
| ~ServiceWorkerContextCore(); |
| + void Shutdown(); |
| + |
| + ServiceWorkerStorage* storage() { return storage_.get(); } |
| bool IsEnabled(); |
| + // The callback will be called on the IO thread. |
| + void RegisterServiceWorker(const GURL& pattern, |
| + const GURL& script_url, |
| + const ResponseCallback& callback); |
| + |
| + // The callback will be called on the IO thread. |
| + void UnregisterServiceWorker(const GURL& pattern, |
| + const base::Closure& callback); |
|
kinuko
2013/11/25 08:17:10
Do these methods never fail? (Maybe no while we'r
alecflett
2013/11/26 00:19:14
Yeah, I figured I could add that later, but I'm ha
|
| + |
| private: |
| - scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| - base::FilePath path_; |
| + void RegistrationComplete( |
| + const ServiceWorkerContextCore::ResponseCallback& callback, |
| + const scoped_refptr<ServiceWorkerRegistration>& registration); |
| + |
| + scoped_ptr<ServiceWorkerStorage> storage_; |
| + bool is_shutdown_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); |
| }; |
| } // namespace content |