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 "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "webkit/appcache/appcache_policy.h" | 13 #include "webkit/appcache/appcache_policy.h" |
14 #include "webkit/appcache/appcache_service.h" | 14 #include "webkit/appcache/appcache_service.h" |
15 #include "webkit/quota/special_storage_policy.h" | 15 #include "webkit/quota/special_storage_policy.h" |
16 | 16 |
17 class FilePath; | 17 class FilePath; |
18 | 18 |
| 19 namespace net { |
| 20 class URLRequestContextGetter; |
| 21 } |
| 22 |
19 namespace content { | 23 namespace content { |
20 class ResourceContext; | 24 class ResourceContext; |
21 } | 25 } |
22 | 26 |
23 struct ChromeAppCacheServiceDeleter; | 27 struct ChromeAppCacheServiceDeleter; |
24 | 28 |
25 // An AppCacheService subclass used by the chrome. There is an instance | 29 // An AppCacheService subclass used by the chrome. There is an instance |
26 // associated with each BrowserContext. This derivation adds refcounting | 30 // associated with each BrowserContext. This derivation adds refcounting |
27 // semantics since a browser context has multiple URLRequestContexts which refer | 31 // semantics since a browser context has multiple URLRequestContexts which refer |
28 // to the same object, and those URLRequestContexts are refcounted independently | 32 // to the same object, and those URLRequestContexts are refcounted independently |
29 // of the owning browser context. | 33 // of the owning browser context. |
30 // | 34 // |
31 // All methods, except the ctor, are expected to be called on | 35 // All methods, except the ctor, are expected to be called on |
32 // the IO thread (unless specifically called out in doc comments). | 36 // the IO thread (unless specifically called out in doc comments). |
33 // | 37 // |
34 // TODO(dpranke): Fix dependencies on AppCacheService so that we don't have | 38 // TODO(dpranke): Fix dependencies on AppCacheService so that we don't have |
35 // to worry about clients calling AppCacheService methods. | 39 // to worry about clients calling AppCacheService methods. |
36 class CONTENT_EXPORT ChromeAppCacheService | 40 class CONTENT_EXPORT ChromeAppCacheService |
37 : public base::RefCountedThreadSafe<ChromeAppCacheService, | 41 : public base::RefCountedThreadSafe<ChromeAppCacheService, |
38 ChromeAppCacheServiceDeleter>, | 42 ChromeAppCacheServiceDeleter>, |
39 NON_EXPORTED_BASE(public appcache::AppCacheService), | 43 NON_EXPORTED_BASE(public appcache::AppCacheService), |
40 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { | 44 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { |
41 public: | 45 public: |
42 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); | 46 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); |
43 | 47 |
44 void InitializeOnIOThread( | 48 void InitializeOnIOThread( |
45 const FilePath& cache_path, // may be empty to use in-memory structures | 49 const FilePath& cache_path, // may be empty to use in-memory structures |
46 content::ResourceContext* resource_context, | 50 content::ResourceContext* resource_context, |
| 51 net::URLRequestContextGetter* request_context_getter, |
47 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 52 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
48 | 53 |
49 // AppCachePolicy overrides | 54 // AppCachePolicy overrides |
50 virtual bool CanLoadAppCache(const GURL& manifest_url, | 55 virtual bool CanLoadAppCache(const GURL& manifest_url, |
51 const GURL& first_party) OVERRIDE; | 56 const GURL& first_party) OVERRIDE; |
52 virtual bool CanCreateAppCache(const GURL& manifest_url, | 57 virtual bool CanCreateAppCache(const GURL& manifest_url, |
53 const GURL& first_party) OVERRIDE; | 58 const GURL& first_party) OVERRIDE; |
54 | 59 |
55 protected: | 60 protected: |
56 virtual ~ChromeAppCacheService(); | 61 virtual ~ChromeAppCacheService(); |
(...skipping 12 matching lines...) Expand all Loading... |
69 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); | 74 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); |
70 }; | 75 }; |
71 | 76 |
72 struct ChromeAppCacheServiceDeleter { | 77 struct ChromeAppCacheServiceDeleter { |
73 static void Destruct(const ChromeAppCacheService* service) { | 78 static void Destruct(const ChromeAppCacheService* service) { |
74 service->DeleteOnCorrectThread(); | 79 service->DeleteOnCorrectThread(); |
75 } | 80 } |
76 }; | 81 }; |
77 | 82 |
78 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 83 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
OLD | NEW |