OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 6 #define CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "content/browser/cache_storage/cache_storage.h" | 15 #include "content/browser/cache_storage/cache_storage.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/browser/cache_storage_context.h" |
| 18 #include "content/public/browser/cache_storage_usage_info.h" |
17 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
18 #include "storage/browser/quota/quota_client.h" | 20 #include "storage/browser/quota/quota_client.h" |
19 #include "url/gurl.h" | 21 #include "url/gurl.h" |
20 | 22 |
21 namespace base { | 23 namespace base { |
22 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
23 } | 25 } |
24 | 26 |
25 namespace storage { | 27 namespace storage { |
26 class BlobStorageContext; | 28 class BlobStorageContext; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // above. | 74 // above. |
73 void SetBlobParametersForCache( | 75 void SetBlobParametersForCache( |
74 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 76 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
75 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); | 77 base::WeakPtr<storage::BlobStorageContext> blob_storage_context); |
76 | 78 |
77 base::WeakPtr<CacheStorageManager> AsWeakPtr() { | 79 base::WeakPtr<CacheStorageManager> AsWeakPtr() { |
78 return weak_ptr_factory_.GetWeakPtr(); | 80 return weak_ptr_factory_.GetWeakPtr(); |
79 } | 81 } |
80 | 82 |
81 private: | 83 private: |
82 friend class CacheStorageQuotaClient; | 84 friend class CacheStorageContextImpl; |
83 friend class CacheStorageManagerTest; | 85 friend class CacheStorageManagerTest; |
84 friend class CacheStorageMigrationTest; | 86 friend class CacheStorageMigrationTest; |
| 87 friend class CacheStorageQuotaClient; |
85 | 88 |
86 typedef std::map<GURL, CacheStorage*> CacheStorageMap; | 89 typedef std::map<GURL, CacheStorage*> CacheStorageMap; |
87 | 90 |
88 CacheStorageManager( | 91 CacheStorageManager( |
89 const base::FilePath& path, | 92 const base::FilePath& path, |
90 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, | 93 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner, |
91 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); | 94 const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy); |
92 | 95 |
93 // The returned CacheStorage* is owned by this manager. | 96 // The returned CacheStorage* is owned by this manager. |
94 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); | 97 CacheStorage* FindOrCreateCacheStorage(const GURL& origin); |
95 | 98 |
96 // QuotaClient support | 99 // QuotaClient and Browsing Data Deletion support |
| 100 void GetAllOriginsUsage( |
| 101 const CacheStorageContext::GetUsageInfoCallback& callback); |
97 void GetOriginUsage(const GURL& origin_url, | 102 void GetOriginUsage(const GURL& origin_url, |
98 const storage::QuotaClient::GetUsageCallback& callback); | 103 const storage::QuotaClient::GetUsageCallback& callback); |
99 void GetOrigins(const storage::QuotaClient::GetOriginsCallback& callback); | 104 void GetOrigins(const storage::QuotaClient::GetOriginsCallback& callback); |
100 void GetOriginsForHost( | 105 void GetOriginsForHost( |
101 const std::string& host, | 106 const std::string& host, |
102 const storage::QuotaClient::GetOriginsCallback& callback); | 107 const storage::QuotaClient::GetOriginsCallback& callback); |
103 void DeleteOriginData(const GURL& origin, | 108 void DeleteOriginData(const GURL& origin, |
104 const storage::QuotaClient::DeletionCallback& callback); | 109 const storage::QuotaClient::DeletionCallback& callback); |
| 110 void DeleteOriginData(const GURL& origin); |
105 static void DeleteOriginDidClose( | 111 static void DeleteOriginDidClose( |
106 const GURL& origin, | 112 const GURL& origin, |
107 const storage::QuotaClient::DeletionCallback& callback, | 113 const storage::QuotaClient::DeletionCallback& callback, |
108 scoped_ptr<CacheStorage> cache_storage, | 114 scoped_ptr<CacheStorage> cache_storage, |
109 base::WeakPtr<CacheStorageManager> cache_manager); | 115 base::WeakPtr<CacheStorageManager> cache_manager); |
| 116 static std::vector<CacheStorageUsageInfo> GetAllOriginsUsageOnTaskRunner( |
| 117 const base::FilePath root_path); |
110 | 118 |
111 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter() | 119 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter() |
112 const { | 120 const { |
113 return request_context_getter_; | 121 return request_context_getter_; |
114 } | 122 } |
115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { | 123 base::WeakPtr<storage::BlobStorageContext> blob_storage_context() const { |
116 return blob_context_; | 124 return blob_context_; |
117 } | 125 } |
118 base::FilePath root_path() const { return root_path_; } | 126 base::FilePath root_path() const { return root_path_; } |
119 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { | 127 const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const { |
(...skipping 29 matching lines...) Expand all Loading... |
149 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 157 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
150 base::WeakPtr<storage::BlobStorageContext> blob_context_; | 158 base::WeakPtr<storage::BlobStorageContext> blob_context_; |
151 | 159 |
152 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; | 160 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; |
153 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); | 161 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); |
154 }; | 162 }; |
155 | 163 |
156 } // namespace content | 164 } // namespace content |
157 | 165 |
158 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 166 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
OLD | NEW |