| 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 #include "content/browser/cache_storage/cache_storage_manager.h" | 5 #include "content/browser/cache_storage/cache_storage_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // the dispatcher host per usual. | 145 // the dispatcher host per usual. |
| 146 manager->SetBlobParametersForCache(old_manager->url_request_context_getter(), | 146 manager->SetBlobParametersForCache(old_manager->url_request_context_getter(), |
| 147 old_manager->blob_storage_context()); | 147 old_manager->blob_storage_context()); |
| 148 return manager; | 148 return manager; |
| 149 } | 149 } |
| 150 | 150 |
| 151 CacheStorageManager::~CacheStorageManager() = default; | 151 CacheStorageManager::~CacheStorageManager() = default; |
| 152 | 152 |
| 153 void CacheStorageManager::OpenCache( | 153 void CacheStorageManager::OpenCache( |
| 154 const GURL& origin, | 154 const GURL& origin, |
| 155 const std::string& cache_name, | 155 const base::string16& cache_name, |
| 156 const CacheStorage::CacheAndErrorCallback& callback) { | 156 const CacheStorage::CacheAndErrorCallback& callback) { |
| 157 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 157 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 158 | 158 |
| 159 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); | 159 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); |
| 160 | 160 |
| 161 cache_storage->OpenCache(cache_name, callback); | 161 cache_storage->OpenCache(cache_name, callback); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void CacheStorageManager::HasCache( | 164 void CacheStorageManager::HasCache( |
| 165 const GURL& origin, | 165 const GURL& origin, |
| 166 const std::string& cache_name, | 166 const base::string16& cache_name, |
| 167 const CacheStorage::BoolAndErrorCallback& callback) { | 167 const CacheStorage::BoolAndErrorCallback& callback) { |
| 168 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 168 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 169 | 169 |
| 170 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); | 170 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); |
| 171 cache_storage->HasCache(cache_name, callback); | 171 cache_storage->HasCache(cache_name, callback); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void CacheStorageManager::DeleteCache( | 174 void CacheStorageManager::DeleteCache( |
| 175 const GURL& origin, | 175 const GURL& origin, |
| 176 const std::string& cache_name, | 176 const base::string16& cache_name, |
| 177 const CacheStorage::BoolAndErrorCallback& callback) { | 177 const CacheStorage::BoolAndErrorCallback& callback) { |
| 178 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 178 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 179 | 179 |
| 180 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); | 180 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); |
| 181 cache_storage->DeleteCache(cache_name, callback); | 181 cache_storage->DeleteCache(cache_name, callback); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void CacheStorageManager::EnumerateCaches( | 184 void CacheStorageManager::EnumerateCaches( |
| 185 const GURL& origin, | 185 const GURL& origin, |
| 186 const CacheStorage::StringsAndErrorCallback& callback) { | 186 const CacheStorage::StringsAndErrorCallback& callback) { |
| 187 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 187 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 188 | 188 |
| 189 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); | 189 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); |
| 190 | 190 |
| 191 cache_storage->EnumerateCaches(callback); | 191 cache_storage->EnumerateCaches(callback); |
| 192 } | 192 } |
| 193 | 193 |
| 194 void CacheStorageManager::MatchCache( | 194 void CacheStorageManager::MatchCache( |
| 195 const GURL& origin, | 195 const GURL& origin, |
| 196 const std::string& cache_name, | 196 const base::string16& cache_name, |
| 197 scoped_ptr<ServiceWorkerFetchRequest> request, | 197 scoped_ptr<ServiceWorkerFetchRequest> request, |
| 198 const CacheStorageCache::ResponseCallback& callback) { | 198 const CacheStorageCache::ResponseCallback& callback) { |
| 199 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); | 199 CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); |
| 200 | 200 |
| 201 cache_storage->MatchCache(cache_name, std::move(request), callback); | 201 cache_storage->MatchCache(cache_name, std::move(request), callback); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void CacheStorageManager::MatchAllCaches( | 204 void CacheStorageManager::MatchAllCaches( |
| 205 const GURL& origin, | 205 const GURL& origin, |
| 206 scoped_ptr<ServiceWorkerFetchRequest> request, | 206 scoped_ptr<ServiceWorkerFetchRequest> request, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 const base::FilePath& old_path, | 447 const base::FilePath& old_path, |
| 448 const base::FilePath& new_path) { | 448 const base::FilePath& new_path) { |
| 449 if (base::PathExists(old_path)) { | 449 if (base::PathExists(old_path)) { |
| 450 if (!base::PathExists(new_path)) | 450 if (!base::PathExists(new_path)) |
| 451 base::Move(old_path, new_path); | 451 base::Move(old_path, new_path); |
| 452 base::DeleteFile(old_path, /*recursive*/ true); | 452 base::DeleteFile(old_path, /*recursive*/ true); |
| 453 } | 453 } |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace content | 456 } // namespace content |
| OLD | NEW |