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

Side by Side Diff: chrome/browser/chromeos/extensions/external_cache.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromeos/extensions/external_cache.h" 5 #include "chrome/browser/chromeos/extensions/external_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 base::Passed(&prefs))); 283 base::Passed(&prefs)));
284 } 284 }
285 285
286 // static 286 // static
287 void ExternalCache::BackendCheckCacheContentsInternal( 287 void ExternalCache::BackendCheckCacheContentsInternal(
288 const base::FilePath& cache_dir, 288 const base::FilePath& cache_dir,
289 base::DictionaryValue* prefs) { 289 base::DictionaryValue* prefs) {
290 // Start by verifying that the cache_dir exists. 290 // Start by verifying that the cache_dir exists.
291 if (!base::DirectoryExists(cache_dir)) { 291 if (!base::DirectoryExists(cache_dir)) {
292 // Create it now. 292 // Create it now.
293 if (!file_util::CreateDirectory(cache_dir)) { 293 if (!base::CreateDirectory(cache_dir)) {
294 LOG(ERROR) << "Failed to create ExternalCache directory at " 294 LOG(ERROR) << "Failed to create ExternalCache directory at "
295 << cache_dir.value(); 295 << cache_dir.value();
296 } 296 }
297 297
298 // Nothing else to do. Cache won't be used. 298 // Nothing else to do. Cache won't be used.
299 return; 299 return;
300 } 300 }
301 301
302 // Enumerate all the files in the cache |cache_dir|, including directories 302 // Enumerate all the files in the cache |cache_dir|, including directories
303 // and symlinks. Each unrecognized file will be erased. 303 // and symlinks. Each unrecognized file will be erased.
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 485
486 if (base::PathExists(cached_crx_path)) { 486 if (base::PathExists(cached_crx_path)) {
487 LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite " 487 LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite "
488 << "an existing cached crx."; 488 << "an existing cached crx.";
489 base::DeleteFile(cached_crx_path, true /* recursive */); 489 base::DeleteFile(cached_crx_path, true /* recursive */);
490 } 490 }
491 491
492 if (!base::DirectoryExists(cache_dir)) { 492 if (!base::DirectoryExists(cache_dir)) {
493 LOG(ERROR) << "AppPack cache directory does not exist, creating now: " 493 LOG(ERROR) << "AppPack cache directory does not exist, creating now: "
494 << cache_dir.value(); 494 << cache_dir.value();
495 if (!file_util::CreateDirectory(cache_dir)) { 495 if (!base::CreateDirectory(cache_dir)) {
496 LOG(ERROR) << "Failed to create the AppPack cache dir!"; 496 LOG(ERROR) << "Failed to create the AppPack cache dir!";
497 base::DeleteFile(path, true /* recursive */); 497 base::DeleteFile(path, true /* recursive */);
498 return; 498 return;
499 } 499 }
500 } 500 }
501 501
502 if (!base::Move(path, cached_crx_path)) { 502 if (!base::Move(path, cached_crx_path)) {
503 LOG(ERROR) << "Failed to move AppPack crx from " << path.value() 503 LOG(ERROR) << "Failed to move AppPack crx from " << path.value()
504 << " to " << cached_crx_path.value(); 504 << " to " << cached_crx_path.value();
505 base::DeleteFile(path, true /* recursive */); 505 base::DeleteFile(path, true /* recursive */);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 FROM_HERE, 554 FROM_HERE,
555 callback); 555 callback);
556 } 556 }
557 557
558 std::string ExternalCache::Delegate::GetInstalledExtensionVersion( 558 std::string ExternalCache::Delegate::GetInstalledExtensionVersion(
559 const std::string& id) { 559 const std::string& id) {
560 return std::string(); 560 return std::string();
561 } 561 }
562 562
563 } // namespace chromeos 563 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698