| 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/appcache/appcache_policy.h" | 12 #include "webkit/appcache/appcache_policy.h" |
| 13 #include "webkit/appcache/appcache_service.h" | 13 #include "webkit/appcache/appcache_service.h" |
| 14 #include "webkit/quota/special_storage_policy.h" | 14 #include "webkit/quota/special_storage_policy.h" |
| 15 | 15 |
| 16 namespace base { |
| 16 class FilePath; | 17 class FilePath; |
| 18 } |
| 17 | 19 |
| 18 namespace net { | 20 namespace net { |
| 19 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 20 } | 22 } |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 class ResourceContext; | 25 class ResourceContext; |
| 24 | 26 |
| 25 struct ChromeAppCacheServiceDeleter; | 27 struct ChromeAppCacheServiceDeleter; |
| 26 | 28 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 // to worry about clients calling AppCacheService methods. | 39 // to worry about clients calling AppCacheService methods. |
| 38 class CONTENT_EXPORT ChromeAppCacheService | 40 class CONTENT_EXPORT ChromeAppCacheService |
| 39 : public base::RefCountedThreadSafe<ChromeAppCacheService, | 41 : public base::RefCountedThreadSafe<ChromeAppCacheService, |
| 40 ChromeAppCacheServiceDeleter>, | 42 ChromeAppCacheServiceDeleter>, |
| 41 NON_EXPORTED_BASE(public appcache::AppCacheService), | 43 NON_EXPORTED_BASE(public appcache::AppCacheService), |
| 42 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { | 44 NON_EXPORTED_BASE(public appcache::AppCachePolicy) { |
| 43 public: | 45 public: |
| 44 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); | 46 explicit ChromeAppCacheService(quota::QuotaManagerProxy* proxy); |
| 45 | 47 |
| 46 void InitializeOnIOThread( | 48 void InitializeOnIOThread( |
| 47 const FilePath& cache_path, // may be empty to use in-memory structures | 49 const base::FilePath& cache_path, // May be empty to use in-memory struct
s. |
| 48 ResourceContext* resource_context, | 50 ResourceContext* resource_context, |
| 49 net::URLRequestContextGetter* request_context_getter, | 51 net::URLRequestContextGetter* request_context_getter, |
| 50 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); | 52 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy); |
| 51 | 53 |
| 52 // AppCachePolicy overrides | 54 // AppCachePolicy overrides |
| 53 virtual bool CanLoadAppCache(const GURL& manifest_url, | 55 virtual bool CanLoadAppCache(const GURL& manifest_url, |
| 54 const GURL& first_party) OVERRIDE; | 56 const GURL& first_party) OVERRIDE; |
| 55 virtual bool CanCreateAppCache(const GURL& manifest_url, | 57 virtual bool CanCreateAppCache(const GURL& manifest_url, |
| 56 const GURL& first_party) OVERRIDE; | 58 const GURL& first_party) OVERRIDE; |
| 57 | 59 |
| 58 protected: | 60 protected: |
| 59 virtual ~ChromeAppCacheService(); | 61 virtual ~ChromeAppCacheService(); |
| 60 | 62 |
| 61 private: | 63 private: |
| 62 friend class base::DeleteHelper<ChromeAppCacheService>; | 64 friend class base::DeleteHelper<ChromeAppCacheService>; |
| 63 friend class base::RefCountedThreadSafe<ChromeAppCacheService, | 65 friend class base::RefCountedThreadSafe<ChromeAppCacheService, |
| 64 ChromeAppCacheServiceDeleter>; | 66 ChromeAppCacheServiceDeleter>; |
| 65 friend struct ChromeAppCacheServiceDeleter; | 67 friend struct ChromeAppCacheServiceDeleter; |
| 66 | 68 |
| 67 void DeleteOnCorrectThread() const; | 69 void DeleteOnCorrectThread() const; |
| 68 | 70 |
| 69 ResourceContext* resource_context_; | 71 ResourceContext* resource_context_; |
| 70 FilePath cache_path_; | 72 base::FilePath cache_path_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); | 74 DISALLOW_COPY_AND_ASSIGN(ChromeAppCacheService); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 struct ChromeAppCacheServiceDeleter { | 77 struct ChromeAppCacheServiceDeleter { |
| 76 static void Destruct(const ChromeAppCacheService* service) { | 78 static void Destruct(const ChromeAppCacheService* service) { |
| 77 service->DeleteOnCorrectThread(); | 79 service->DeleteOnCorrectThread(); |
| 78 } | 80 } |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace content | 83 } // namespace content |
| 82 | 84 |
| 83 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ | 85 #endif // CONTENT_BROWSER_APPCACHE_CHROME_APPCACHE_SERVICE_H_ |
| OLD | NEW |