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

Side by Side Diff: chrome/browser/extensions/updater/local_extension_cache.cc

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 "chrome/browser/extensions/updater/local_extension_cache.h" 5 #include "chrome/browser/extensions/updater/local_extension_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 413
414 // Skip flag file that indicates that cache is ready. 414 // Skip flag file that indicates that cache is ready.
415 if (basename == kCacheReadyFlagFileName) 415 if (basename == kCacheReadyFlagFileName)
416 continue; 416 continue;
417 417
418 // crx files in the cache are named 418 // crx files in the cache are named
419 // <extension-id>-<version>[-<expected_hash>].crx. 419 // <extension-id>-<version>[-<expected_hash>].crx.
420 std::string id; 420 std::string id;
421 std::string version; 421 std::string version;
422 std::string expected_hash; 422 std::string expected_hash;
423 if (EndsWith(basename, kCRXFileExtension, false /* case-sensitive */)) { 423 if (base::EndsWith(basename, kCRXFileExtension,
424 false /* case-sensitive */)) {
424 size_t n = basename.find('-'); 425 size_t n = basename.find('-');
425 if (n != std::string::npos && n + 1 < basename.size() - 4) { 426 if (n != std::string::npos && n + 1 < basename.size() - 4) {
426 id = basename.substr(0, n); 427 id = basename.substr(0, n);
427 // Size of |version| = total size - "<id>" - "-" - ".crx" 428 // Size of |version| = total size - "<id>" - "-" - ".crx"
428 version = basename.substr(n + 1, basename.size() - 5 - id.size()); 429 version = basename.substr(n + 1, basename.size() - 5 - id.size());
429 430
430 n = version.find('-'); 431 n = version.find('-');
431 if (n != std::string::npos && n + 1 < version.size()) { 432 if (n != std::string::npos && n + 1 < version.size()) {
432 expected_hash = version.substr(n + 1, version.size() - n - 1); 433 expected_hash = version.substr(n + 1, version.size() - n - 1);
433 version.resize(n); 434 version.resize(n);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 expected_hash(base::StringToLowerASCII(expected_hash)), 615 expected_hash(base::StringToLowerASCII(expected_hash)),
615 last_used(last_used), 616 last_used(last_used),
616 size(size), 617 size(size),
617 file_path(file_path) { 618 file_path(file_path) {
618 } 619 }
619 620
620 LocalExtensionCache::CacheItemInfo::~CacheItemInfo() { 621 LocalExtensionCache::CacheItemInfo::~CacheItemInfo() {
621 } 622 }
622 623
623 } // namespace extensions 624 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | chrome/browser/metrics/chromeos_metrics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698