OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 6 #define CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/sequenced_task_runner_helpers.h" | 10 #include "base/sequenced_task_runner_helpers.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "webkit/browser/appcache/appcache_policy.h" | 12 #include "webkit/browser/appcache/appcache_policy.h" |
13 #include "webkit/browser/appcache/appcache_service.h" | 13 #include "webkit/browser/appcache/appcache_service.h" |
14 #include "webkit/browser/quota/special_storage_policy.h" | 14 #include "webkit/browser/quota/special_storage_policy.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class FilePath; | 17 class FilePath; |
18 } | 18 } |
19 | |
20 namespace net { | 19 namespace net { |
21 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
22 } | 21 } |
| 22 namespace webkit_blob { |
| 23 class BlobStorageController; |
| 24 } |
| 25 |
23 | 26 |
24 namespace content { | 27 namespace content { |
| 28 class AppCacheExecutableHandlerFactoryImpl; |
25 class ResourceContext; | 29 class ResourceContext; |
26 | 30 class WorkerStoragePartition; |
27 struct ChromeAppCacheServiceDeleter; | 31 struct ChromeAppCacheServiceDeleter; |
| 32 class ChromeBlobStorageContext; |
28 | 33 |
29 // An AppCacheService subclass used by the chrome. There is an instance | 34 // An AppCacheService subclass used by the chrome. There is an instance |
30 // associated with each BrowserContext. This derivation adds refcounting | 35 // associated with each BrowserContext. This derivation adds refcounting |
31 // semantics since a browser context has multiple URLRequestContexts which refer | 36 // semantics since a browser context has multiple URLRequestContexts which refer |
32 // to the same object, and those URLRequestContexts are refcounted independently | 37 // to the same object, and those URLRequestContexts are refcounted independently |
33 // of the owning browser context. | 38 // of the owning browser context. |
34 // | 39 // |
35 // All methods, except the ctor, are expected to be called on | 40 // All methods, except the ctor, are expected to be called on |
36 // the IO thread (unless specifically called out in doc comments). | 41 // the IO thread (unless specifically called out in doc comments). |
37 // | 42 // |
38 // TODO(dpranke): Fix dependencies on AppCacheService so that we don't have | 43 // TODO(dpranke): Fix dependencies on AppCacheService so that we don't have |
39 // to worry about clients calling AppCacheService methods. | 44 // to worry about clients calling AppCacheService methods. |
40 class CONTENT_EXPORT ChromeAppCacheService | 45 class CONTENT_EXPORT ChromeAppCacheService |
41 : public base::RefCountedThreadSafe<ChromeAppCacheService, | 46 : public base::RefCountedThreadSafe<ChromeAppCacheService, |
42 ChromeAppCacheServiceDeleter>, | 47 ChromeAppCacheServiceDeleter>, |
43 NON_EXPORTED_BASE(public appcache::AppCacheService), | 48 NON_EXPORTED_BASE(public appcache::AppCacheService), |
44 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { | 49 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { |
45 public: | 50 public: |
46 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); | 51 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); |
47 | 52 |
48 void InitializeOnIOThread( | 53 void InitializeOnIOThread( |
49 const base::FilePath& cache_path, // May be empty to use in-memory struct
s. | 54 const base::FilePath& cache_path, // May be empty to use in-memory struct
s. |
50 ResourceContext* resource_context, | 55 ResourceContext* resource_context, |
51 net::URLRequestContextGetter* request_context_getter, | 56 net::URLRequestContextGetter* request_context_getter, |
52 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 57 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
| 58 const WorkerStoragePartition& worker_storage_partition, |
| 59 ChromeBlobStorageContext* blob_context); |
53 | 60 |
54 // AppCachePolicy overrides | 61 // AppCachePolicy overrides |
55 virtual bool CanLoadAppCache(const GURL& manifest_url, | 62 virtual bool CanLoadAppCache(const GURL& manifest_url, |
56 const GURL& first_party) OVERRIDE; | 63 const GURL& first_party) OVERRIDE; |
57 virtual bool CanCreateAppCache(const GURL& manifest_url, | 64 virtual bool CanCreateAppCache(const GURL& manifest_url, |
58 const GURL& first_party) OVERRIDE; | 65 const GURL& first_party) OVERRIDE; |
59 | 66 |
60 protected: | 67 protected: |
61 virtual ~ChromeAppCacheService(); | 68 virtual ~ChromeAppCacheService(); |
62 | 69 |
63 private: | 70 private: |
64 friend class base::DeleteHelper<ChromeAppCacheService>; | 71 friend class base::DeleteHelper<ChromeAppCacheService>; |
65 friend class base::RefCountedThreadSafe<ChromeAppCacheService, | 72 friend class base::RefCountedThreadSafe<ChromeAppCacheService, |
66 ChromeAppCacheServiceDeleter>; | 73 ChromeAppCacheServiceDeleter>; |
67 friend struct ChromeAppCacheServiceDeleter; | 74 friend struct ChromeAppCacheServiceDeleter; |
68 | 75 |
69 void DeleteOnCorrectThread() const; | 76 void DeleteOnCorrectThread() const; |
70 | 77 |
71 ResourceContext* resource_context_; | 78 ResourceContext* resource_context_; |
72 base::FilePath cache_path_; | 79 base::FilePath cache_path_; |
| 80 scoped_ptr<AppCacheExecutableHandlerFactoryImpl> executable_handler_factory_; |
73 | 81 |
74 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); | 82 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); |
75 }; | 83 }; |
76 | 84 |
77 struct ChromeAppCacheServiceDeleter { | 85 struct ChromeAppCacheServiceDeleter { |
78 static void Destruct(const ChromeAppCacheService* service) { | 86 static void Destruct(const ChromeAppCacheService* service) { |
79 service->DeleteOnCorrectThread(); | 87 service->DeleteOnCorrectThread(); |
80 } | 88 } |
81 }; | 89 }; |
82 | 90 |
83 } // namespace content | 91 } // namespace content |
84 | 92 |
85 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 93 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
OLD | NEW |