| 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_APPCACHE_QUOTA_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_QUOTA_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_QUOTA_CLIENT_H_ | 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_QUOTA_CLIENT_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace content { | 22 namespace content { |
| 23 class AppCacheQuotaClientTest; | 23 class AppCacheQuotaClientTest; |
| 24 class AppCacheServiceImpl; | 24 class AppCacheServiceImpl; |
| 25 class AppCacheStorageImpl; | 25 class AppCacheStorageImpl; |
| 26 | 26 |
| 27 // A QuotaClient implementation to integrate the appcache service | 27 // A QuotaClient implementation to integrate the appcache service |
| 28 // with the quota management system. The QuotaClient interface is | 28 // with the quota management system. The QuotaClient interface is |
| 29 // used on the IO thread by the quota manager. This class deletes | 29 // used on the IO thread by the quota manager. This class deletes |
| 30 // itself when both the quota manager and the appcache service have | 30 // itself when both the quota manager and the appcache service have |
| 31 // been destroyed. | 31 // been destroyed. |
| 32 class AppCacheQuotaClient : public quota::QuotaClient { | 32 class AppCacheQuotaClient : public storage::QuotaClient { |
| 33 public: | 33 public: |
| 34 typedef std::deque<base::Closure> RequestQueue; | 34 typedef std::deque<base::Closure> RequestQueue; |
| 35 | 35 |
| 36 virtual ~AppCacheQuotaClient(); | 36 virtual ~AppCacheQuotaClient(); |
| 37 | 37 |
| 38 // QuotaClient method overrides | 38 // QuotaClient method overrides |
| 39 virtual ID id() const OVERRIDE; | 39 virtual ID id() const OVERRIDE; |
| 40 virtual void OnQuotaManagerDestroyed() OVERRIDE; | 40 virtual void OnQuotaManagerDestroyed() OVERRIDE; |
| 41 virtual void GetOriginUsage(const GURL& origin, | 41 virtual void GetOriginUsage(const GURL& origin, |
| 42 quota::StorageType type, | 42 storage::StorageType type, |
| 43 const GetUsageCallback& callback) OVERRIDE; | 43 const GetUsageCallback& callback) OVERRIDE; |
| 44 virtual void GetOriginsForType(quota::StorageType type, | 44 virtual void GetOriginsForType(storage::StorageType type, |
| 45 const GetOriginsCallback& callback) OVERRIDE; | 45 const GetOriginsCallback& callback) OVERRIDE; |
| 46 virtual void GetOriginsForHost(quota::StorageType type, | 46 virtual void GetOriginsForHost(storage::StorageType type, |
| 47 const std::string& host, | 47 const std::string& host, |
| 48 const GetOriginsCallback& callback) OVERRIDE; | 48 const GetOriginsCallback& callback) OVERRIDE; |
| 49 virtual void DeleteOriginData(const GURL& origin, | 49 virtual void DeleteOriginData(const GURL& origin, |
| 50 quota::StorageType type, | 50 storage::StorageType type, |
| 51 const DeletionCallback& callback) OVERRIDE; | 51 const DeletionCallback& callback) OVERRIDE; |
| 52 virtual bool DoesSupport(quota::StorageType type) const OVERRIDE; | 52 virtual bool DoesSupport(storage::StorageType type) const OVERRIDE; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class content::AppCacheQuotaClientTest; | 55 friend class content::AppCacheQuotaClientTest; |
| 56 friend class AppCacheServiceImpl; // for NotifyAppCacheIsDestroyed | 56 friend class AppCacheServiceImpl; // for NotifyAppCacheIsDestroyed |
| 57 friend class AppCacheStorageImpl; // for NotifyAppCacheIsReady | 57 friend class AppCacheStorageImpl; // for NotifyAppCacheIsReady |
| 58 | 58 |
| 59 CONTENT_EXPORT | 59 CONTENT_EXPORT |
| 60 explicit AppCacheQuotaClient(AppCacheServiceImpl* service); | 60 explicit AppCacheQuotaClient(AppCacheServiceImpl* service); |
| 61 | 61 |
| 62 void DidDeleteAppCachesForOrigin(int rv); | 62 void DidDeleteAppCachesForOrigin(int rv); |
| 63 void GetOriginsHelper(quota::StorageType type, | 63 void GetOriginsHelper(storage::StorageType type, |
| 64 const std::string& opt_host, | 64 const std::string& opt_host, |
| 65 const GetOriginsCallback& callback); | 65 const GetOriginsCallback& callback); |
| 66 void ProcessPendingRequests(); | 66 void ProcessPendingRequests(); |
| 67 void DeletePendingRequests(); | 67 void DeletePendingRequests(); |
| 68 const AppCacheStorage::UsageMap* GetUsageMap(); | 68 const AppCacheStorage::UsageMap* GetUsageMap(); |
| 69 net::CancelableCompletionCallback* GetServiceDeleteCallback(); | 69 net::CancelableCompletionCallback* GetServiceDeleteCallback(); |
| 70 | 70 |
| 71 // For use by appcache internals during initialization and shutdown. | 71 // For use by appcache internals during initialization and shutdown. |
| 72 CONTENT_EXPORT void NotifyAppCacheReady(); | 72 CONTENT_EXPORT void NotifyAppCacheReady(); |
| 73 CONTENT_EXPORT void NotifyAppCacheDestroyed(); | 73 CONTENT_EXPORT void NotifyAppCacheDestroyed(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 85 AppCacheServiceImpl* service_; | 85 AppCacheServiceImpl* service_; |
| 86 bool appcache_is_ready_; | 86 bool appcache_is_ready_; |
| 87 bool quota_manager_is_destroyed_; | 87 bool quota_manager_is_destroyed_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(AppCacheQuotaClient); | 89 DISALLOW_COPY_AND_ASSIGN(AppCacheQuotaClient); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace content | 92 } // namespace content |
| 93 | 93 |
| 94 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_QUOTA_CLIENT_H_ | 94 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_QUOTA_CLIENT_H_ |
| OLD | NEW |