| 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_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
| 10 | 11 |
| 11 namespace base { | 12 namespace base { |
| 12 class FilePath; | 13 class FilePath; |
| 13 } | 14 } |
| 14 | 15 |
| 15 namespace quota { | 16 namespace quota { |
| 16 class QuotaManagerProxy; | 17 class QuotaManagerProxy; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // This class manages metadata associated with all service workers, | 22 // This class manages metadata associated with all service workers, |
| 22 // including: | 23 // including: |
| 23 // - persistent storage of pattern -> service worker scripts | 24 // - persistent storage of pattern -> service worker scripts |
| 24 // - initialization and initial installation of service workers | 25 // - initialization and initial installation of service workers |
| 25 // - dispatching of non-fetch events to service workers | 26 // - dispatching of non-fetch events to service workers |
| 26 class ServiceWorkerContext | 27 class CONTENT_EXPORT ServiceWorkerContext |
| 27 : public base::RefCountedThreadSafe<ServiceWorkerContext> { | 28 : public base::RefCountedThreadSafe<ServiceWorkerContext> { |
| 28 public: | 29 public: |
| 29 // This is owned by the StoragePartition, which will supply it with | 30 // This is owned by the StoragePartition, which will supply it with |
| 30 // the local path on disk. | 31 // the local path on disk. |
| 31 ServiceWorkerContext(const base::FilePath& path, | 32 ServiceWorkerContext(const base::FilePath& path, |
| 32 quota::QuotaManagerProxy* quota_manager_proxy); | 33 quota::QuotaManagerProxy* quota_manager_proxy); |
| 33 | 34 |
| 35 bool IsEnabled(); |
| 36 |
| 34 private: | 37 private: |
| 35 friend class base::RefCountedThreadSafe<ServiceWorkerContext>; | 38 friend class base::RefCountedThreadSafe<ServiceWorkerContext>; |
| 36 ~ServiceWorkerContext(); | 39 ~ServiceWorkerContext(); |
| 37 | 40 |
| 38 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 41 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
| 39 base::FilePath path_; | 42 base::FilePath path_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext); |
| 40 }; | 45 }; |
| 41 | 46 |
| 42 } // namespace content | 47 } // namespace content |
| 43 | 48 |
| 44 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ | 49 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_H_ |
| OLD | NEW |