| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // The process manager can be used on either UI or IO. | 62 // The process manager can be used on either UI or IO. |
| 63 ServiceWorkerProcessManager* process_manager() { | 63 ServiceWorkerProcessManager* process_manager() { |
| 64 return process_manager_.get(); | 64 return process_manager_.get(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // ServiceWorkerContext implementation: | 67 // ServiceWorkerContext implementation: |
| 68 virtual void RegisterServiceWorker( | 68 virtual void RegisterServiceWorker( |
| 69 const GURL& pattern, | 69 const GURL& pattern, |
| 70 const GURL& script_url, | 70 const GURL& script_url, |
| 71 const ResultCallback& continuation) override; | 71 const ResultCallback& continuation) override; |
| 72 virtual void UnregisterServiceWorker( | 72 virtual void UnregisterServiceWorker(const GURL& pattern, |
| 73 const GURL& pattern, | 73 const ResultCallback& continuation) |
| 74 const ResultCallback& continuation) override; | 74 override; |
| 75 virtual void Terminate() override; | 75 virtual void Terminate() override; |
| 76 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; | 76 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) override; |
| 77 virtual void DeleteForOrigin(const GURL& origin_url) override; | 77 virtual void DeleteForOrigin(const GURL& origin_url) override; |
| 78 | 78 |
| 79 // DeleteForOrigin with completion callback. Does not exit early, and returns | |
| 80 // false if one or more of the deletions fail. | |
| 81 virtual void DeleteForOrigin(const GURL& origin_url, | |
| 82 const ResultCallback& done); | |
| 83 | |
| 84 void AddObserver(ServiceWorkerContextObserver* observer); | 79 void AddObserver(ServiceWorkerContextObserver* observer); |
| 85 void RemoveObserver(ServiceWorkerContextObserver* observer); | 80 void RemoveObserver(ServiceWorkerContextObserver* observer); |
| 86 | 81 |
| 87 bool is_incognito() const { return is_incognito_; } | 82 bool is_incognito() const { return is_incognito_; } |
| 88 | 83 |
| 89 // The URLRequestContext doesn't exist until after the StoragePartition is | 84 // The URLRequestContext doesn't exist until after the StoragePartition is |
| 90 // made (which is after this object is made). This function must be called | 85 // made (which is after this object is made). This function must be called |
| 91 // after this object is created but before any ServiceWorkerCache operations. | 86 // after this object is created but before any ServiceWorkerCache operations. |
| 92 // It must be called on the IO thread. If either parameter is NULL the | 87 // It must be called on the IO thread. If either parameter is NULL the |
| 93 // function immediately returns without forwarding to the | 88 // function immediately returns without forwarding to the |
| 94 // ServiceWorkerCacheStorageManager. | 89 // ServiceWorkerCacheStorageManager. |
| 95 void SetBlobParametersForCache( | 90 void SetBlobParametersForCache( |
| 96 net::URLRequestContextGetter* request_context, | 91 net::URLRequestContextGetter* request_context, |
| 97 ChromeBlobStorageContext* blob_storage_context); | 92 ChromeBlobStorageContext* blob_storage_context); |
| 98 | 93 |
| 99 private: | 94 private: |
| 100 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; | 95 friend class base::RefCountedThreadSafe<ServiceWorkerContextWrapper>; |
| 101 friend class EmbeddedWorkerTestHelper; | 96 friend class EmbeddedWorkerTestHelper; |
| 102 friend class ServiceWorkerProcessManager; | 97 friend class ServiceWorkerProcessManager; |
| 103 | |
| 104 virtual ~ServiceWorkerContextWrapper(); | 98 virtual ~ServiceWorkerContextWrapper(); |
| 105 | 99 |
| 106 void InitInternal( | 100 void InitInternal( |
| 107 const base::FilePath& user_data_directory, | 101 const base::FilePath& user_data_directory, |
| 108 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner, | 102 const scoped_refptr<base::SequencedTaskRunner>& stores_task_runner, |
| 109 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, | 103 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, |
| 110 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, | 104 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, |
| 111 storage::QuotaManagerProxy* quota_manager_proxy); | 105 storage::QuotaManagerProxy* quota_manager_proxy); |
| 112 void ShutdownOnIO(); | 106 void ShutdownOnIO(); |
| 113 | 107 |
| 114 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); | 108 void DidDeleteAndStartOver(ServiceWorkerStatusCode status); |
| 115 | 109 |
| 116 void DidGetAllRegistrationsForGetAllOrigins( | 110 void DidGetAllRegistrationsForGetAllOrigins( |
| 117 const GetUsageInfoCallback& callback, | 111 const GetUsageInfoCallback& callback, |
| 118 const std::vector<ServiceWorkerRegistrationInfo>& registrations); | 112 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
| 113 void DidGetAllRegistrationsForDeleteForOrigin( |
| 114 const GURL& origin, |
| 115 const std::vector<ServiceWorkerRegistrationInfo>& registrations); |
| 119 | 116 |
| 120 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > | 117 const scoped_refptr<ObserverListThreadSafe<ServiceWorkerContextObserver> > |
| 121 observer_list_; | 118 observer_list_; |
| 122 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; | 119 const scoped_ptr<ServiceWorkerProcessManager> process_manager_; |
| 123 // Cleared in Shutdown(): | 120 // Cleared in Shutdown(): |
| 124 scoped_ptr<ServiceWorkerContextCore> context_core_; | 121 scoped_ptr<ServiceWorkerContextCore> context_core_; |
| 125 | 122 |
| 126 // Initialized in Init(); true of the user data directory is empty. | 123 // Initialized in Init(); true of the user data directory is empty. |
| 127 bool is_incognito_; | 124 bool is_incognito_; |
| 128 }; | 125 }; |
| 129 | 126 |
| 130 } // namespace content | 127 } // namespace content |
| 131 | 128 |
| 132 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 129 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
| OLD | NEW |