| 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/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/strings/string16.h" |
| 14 #include "content/browser/cache_storage/cache_storage.h" | 15 #include "content/browser/cache_storage/cache_storage.h" |
| 15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 16 #include "content/public/browser/cache_storage_context.h" | 17 #include "content/public/browser/cache_storage_context.h" |
| 17 #include "content/public/browser/cache_storage_usage_info.h" | 18 #include "content/public/browser/cache_storage_usage_info.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 19 #include "net/url_request/url_request_context_getter.h" |
| 19 #include "storage/browser/quota/quota_client.h" | 20 #include "storage/browser/quota/quota_client.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 48 | 49 |
| 49 // Map a database identifier (computed from an origin) to the path. | 50 // Map a database identifier (computed from an origin) to the path. |
| 50 static base::FilePath ConstructOriginPath(const base::FilePath& root_path, | 51 static base::FilePath ConstructOriginPath(const base::FilePath& root_path, |
| 51 const GURL& origin); | 52 const GURL& origin); |
| 52 | 53 |
| 53 virtual ~CacheStorageManager(); | 54 virtual ~CacheStorageManager(); |
| 54 | 55 |
| 55 // Methods to support the CacheStorage spec. These methods call the | 56 // Methods to support the CacheStorage spec. These methods call the |
| 56 // corresponding CacheStorage method on the appropriate thread. | 57 // corresponding CacheStorage method on the appropriate thread. |
| 57 void OpenCache(const GURL& origin, | 58 void OpenCache(const GURL& origin, |
| 58 const std::string& cache_name, | 59 const base::string16& cache_name, |
| 59 const CacheStorage::CacheAndErrorCallback& callback); | 60 const CacheStorage::CacheAndErrorCallback& callback); |
| 60 void HasCache(const GURL& origin, | 61 void HasCache(const GURL& origin, |
| 61 const std::string& cache_name, | 62 const base::string16& cache_name, |
| 62 const CacheStorage::BoolAndErrorCallback& callback); | 63 const CacheStorage::BoolAndErrorCallback& callback); |
| 63 void DeleteCache(const GURL& origin, | 64 void DeleteCache(const GURL& origin, |
| 64 const std::string& cache_name, | 65 const base::string16& cache_name, |
| 65 const CacheStorage::BoolAndErrorCallback& callback); | 66 const CacheStorage::BoolAndErrorCallback& callback); |
| 66 void EnumerateCaches(const GURL& origin, | 67 void EnumerateCaches(const GURL& origin, |
| 67 const CacheStorage::StringsAndErrorCallback& callback); | 68 const CacheStorage::StringsAndErrorCallback& callback); |
| 68 void MatchCache(const GURL& origin, | 69 void MatchCache(const GURL& origin, |
| 69 const std::string& cache_name, | 70 const base::string16& cache_name, |
| 70 scoped_ptr<ServiceWorkerFetchRequest> request, | 71 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 71 const CacheStorageCache::ResponseCallback& callback); | 72 const CacheStorageCache::ResponseCallback& callback); |
| 72 void MatchAllCaches(const GURL& origin, | 73 void MatchAllCaches(const GURL& origin, |
| 73 scoped_ptr<ServiceWorkerFetchRequest> request, | 74 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 74 const CacheStorageCache::ResponseCallback& callback); | 75 const CacheStorageCache::ResponseCallback& callback); |
| 75 | 76 |
| 76 // This must be called before creating any of the public *Cache functions | 77 // This must be called before creating any of the public *Cache functions |
| 77 // above. | 78 // above. |
| 78 void SetBlobParametersForCache( | 79 void SetBlobParametersForCache( |
| 79 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 80 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 162 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
| 162 base::WeakPtr<storage::BlobStorageContext> blob_context_; | 163 base::WeakPtr<storage::BlobStorageContext> blob_context_; |
| 163 | 164 |
| 164 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; | 165 base::WeakPtrFactory<CacheStorageManager> weak_ptr_factory_; |
| 165 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); | 166 DISALLOW_COPY_AND_ASSIGN(CacheStorageManager); |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 } // namespace content | 169 } // namespace content |
| 169 | 170 |
| 170 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ | 171 #endif // CONTENT_BROWSER_CACHE_STORAGE_CACHE_STORAGE_MANAGER_H_ |
| OLD | NEW |