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/drive/file_cache.cc

Issue 18332014: Move Copy* into the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drive/file_cache.h" 5 #include "chrome/browser/chromeos/drive/file_cache.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 const base::FilePath& dest_path) { 83 const base::FilePath& dest_path) {
84 if (!base::Move(source_path, dest_path)) { 84 if (!base::Move(source_path, dest_path)) {
85 LOG(ERROR) << "Failed to move " << source_path.value() 85 LOG(ERROR) << "Failed to move " << source_path.value()
86 << " to " << dest_path.value(); 86 << " to " << dest_path.value();
87 return false; 87 return false;
88 } 88 }
89 DVLOG(1) << "Moved " << source_path.value() << " to " << dest_path.value(); 89 DVLOG(1) << "Moved " << source_path.value() << " to " << dest_path.value();
90 return true; 90 return true;
91 } 91 }
92 92
93 // Copies the file. 93 // Copies the file. Note this isn't called CopyFile which collides with
94 bool CopyFile(const base::FilePath& source_path, 94 // base::CopyFile when doing argument-dependent name lookup.
95 const base::FilePath& dest_path) { 95 bool CopyFileWrapper(const base::FilePath& source_path,
brettw 2013/07/01 21:52:56 Note: non-search-and-replace change here.
96 if (!file_util::CopyFile(source_path, dest_path)) { 96 const base::FilePath& dest_path) {
97 if (!base::CopyFile(source_path, dest_path)) {
97 LOG(ERROR) << "Failed to copy " << source_path.value() 98 LOG(ERROR) << "Failed to copy " << source_path.value()
98 << " to " << dest_path.value(); 99 << " to " << dest_path.value();
99 return false; 100 return false;
100 } 101 }
101 DVLOG(1) << "Copied " << source_path.value() << " to " << dest_path.value(); 102 DVLOG(1) << "Copied " << source_path.value() << " to " << dest_path.value();
102 return true; 103 return true;
103 } 104 }
104 105
105 // Deletes all files that match |path_to_delete_pattern| except for 106 // Deletes all files that match |path_to_delete_pattern| except for
106 // |path_to_keep| on blocking pool. 107 // |path_to_keep| on blocking pool.
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return FILE_ERROR_IN_USE; 677 return FILE_ERROR_IN_USE;
677 678
678 base::FilePath dest_path = GetCacheFilePath(resource_id, md5, 679 base::FilePath dest_path = GetCacheFilePath(resource_id, md5,
679 CACHED_FILE_FROM_SERVER); 680 CACHED_FILE_FROM_SERVER);
680 bool success = false; 681 bool success = false;
681 switch (file_operation_type) { 682 switch (file_operation_type) {
682 case FILE_OPERATION_MOVE: 683 case FILE_OPERATION_MOVE:
683 success = MoveFile(source_path, dest_path); 684 success = MoveFile(source_path, dest_path);
684 break; 685 break;
685 case FILE_OPERATION_COPY: 686 case FILE_OPERATION_COPY:
686 success = CopyFile(source_path, dest_path); 687 success = CopyFileWrapper(source_path, dest_path);
687 break; 688 break;
688 default: 689 default:
689 NOTREACHED(); 690 NOTREACHED();
690 } 691 }
691 692
692 // Determine search pattern for stale filenames corresponding to resource_id, 693 // Determine search pattern for stale filenames corresponding to resource_id,
693 // either "<resource_id>*" or "<resource_id>.*". 694 // either "<resource_id>*" or "<resource_id>.*".
694 base::FilePath stale_filenames_pattern; 695 base::FilePath stale_filenames_pattern;
695 if (md5.empty()) { 696 if (md5.empty()) {
696 // No md5 means no extension, append '*' after base name, i.e. 697 // No md5 means no extension, append '*' after base name, i.e.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 } 832 }
832 } 833 }
833 834
834 // Delete old DB. 835 // Delete old DB.
835 base::Delete(old_db_path, true /* recursive */ ); 836 base::Delete(old_db_path, true /* recursive */ );
836 return imported; 837 return imported;
837 } 838 }
838 839
839 } // namespace internal 840 } // namespace internal
840 } // namespace drive 841 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_storage.cc ('k') | chrome/browser/chromeos/drive/file_system/copy_operation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698