Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(395)

Side by Side Diff: content/browser/cache_storage/cache_storage_manager.cc

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 return cache_storage; 316 return cache_storage;
317 } 317 }
318 return it->second; 318 return it->second;
319 } 319 }
320 320
321 // static 321 // static
322 base::FilePath CacheStorageManager::ConstructLegacyOriginPath( 322 base::FilePath CacheStorageManager::ConstructLegacyOriginPath(
323 const base::FilePath& root_path, 323 const base::FilePath& root_path,
324 const GURL& origin) { 324 const GURL& origin) {
325 const std::string origin_hash = base::SHA1HashString(origin.spec()); 325 const std::string origin_hash = base::SHA1HashString(origin.spec());
326 const std::string origin_hash_hex = base::StringToLowerASCII( 326 const std::string origin_hash_hex = base::ToLowerASCII(
327 base::HexEncode(origin_hash.c_str(), origin_hash.length())); 327 base::HexEncode(origin_hash.c_str(), origin_hash.length()));
328 return root_path.AppendASCII(origin_hash_hex); 328 return root_path.AppendASCII(origin_hash_hex);
329 } 329 }
330 330
331 // static 331 // static
332 base::FilePath CacheStorageManager::ConstructOriginPath( 332 base::FilePath CacheStorageManager::ConstructOriginPath(
333 const base::FilePath& root_path, 333 const base::FilePath& root_path,
334 const GURL& origin) { 334 const GURL& origin) {
335 const std::string identifier = storage::GetIdentifierFromOrigin(origin); 335 const std::string identifier = storage::GetIdentifierFromOrigin(origin);
336 const std::string origin_hash = base::SHA1HashString(identifier); 336 const std::string origin_hash = base::SHA1HashString(identifier);
337 const std::string origin_hash_hex = base::StringToLowerASCII( 337 const std::string origin_hash_hex = base::ToLowerASCII(
338 base::HexEncode(origin_hash.c_str(), origin_hash.length())); 338 base::HexEncode(origin_hash.c_str(), origin_hash.length()));
339 return root_path.AppendASCII(origin_hash_hex); 339 return root_path.AppendASCII(origin_hash_hex);
340 } 340 }
341 341
342 // Migrate from old origin-based path to storage identifier-based path. 342 // Migrate from old origin-based path to storage identifier-based path.
343 // TODO(jsbell); Remove after a few releases. 343 // TODO(jsbell); Remove after a few releases.
344 void CacheStorageManager::MigrateOrigin(const GURL& origin) { 344 void CacheStorageManager::MigrateOrigin(const GURL& origin) {
345 if (IsMemoryBacked()) 345 if (IsMemoryBacked())
346 return; 346 return;
347 base::FilePath old_path = ConstructLegacyOriginPath(root_path_, origin); 347 base::FilePath old_path = ConstructLegacyOriginPath(root_path_, origin);
348 base::FilePath new_path = ConstructOriginPath(root_path_, origin); 348 base::FilePath new_path = ConstructOriginPath(root_path_, origin);
349 cache_task_runner_->PostTask( 349 cache_task_runner_->PostTask(
350 FROM_HERE, base::Bind(&MigrateOriginOnTaskRunner, old_path, new_path)); 350 FROM_HERE, base::Bind(&MigrateOriginOnTaskRunner, old_path, new_path));
351 } 351 }
352 352
353 // static 353 // static
354 void CacheStorageManager::MigrateOriginOnTaskRunner( 354 void CacheStorageManager::MigrateOriginOnTaskRunner(
355 const base::FilePath& old_path, 355 const base::FilePath& old_path,
356 const base::FilePath& new_path) { 356 const base::FilePath& new_path) {
357 if (base::PathExists(old_path)) { 357 if (base::PathExists(old_path)) {
358 if (!base::PathExists(new_path)) 358 if (!base::PathExists(new_path))
359 base::Move(old_path, new_path); 359 base::Move(old_path, new_path);
360 base::DeleteFile(old_path, /*recursive*/ true); 360 base::DeleteFile(old_path, /*recursive*/ true);
361 } 361 }
362 } 362 }
363 363
364 } // namespace content 364 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage.cc ('k') | content/child/browser_font_resource_trusted.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698