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

Side by Side Diff: chrome/installer/util/delete_tree_work_item.cc

Issue 18383003: Move DeleteAfterReboot and Move to 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/installer/util/delete_tree_work_item.h" 5 #include "chrome/installer/util/delete_tree_work_item.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 // If there are files in backup paths move them back. 138 // If there are files in backup paths move them back.
139 void DeleteTreeWorkItem::Rollback() { 139 void DeleteTreeWorkItem::Rollback() {
140 if (ignore_failure_) 140 if (ignore_failure_)
141 return; 141 return;
142 142
143 if (copied_to_backup_) { 143 if (copied_to_backup_) {
144 DCHECK(!backup_path_.path().empty()); 144 DCHECK(!backup_path_.path().empty());
145 base::FilePath backup = backup_path_.path().Append(root_path_.BaseName()); 145 base::FilePath backup = backup_path_.path().Append(root_path_.BaseName());
146 if (file_util::PathExists(backup)) 146 if (file_util::PathExists(backup))
147 file_util::Move(backup, root_path_); 147 base::Move(backup, root_path_);
148 } 148 }
149 149
150 for (ptrdiff_t i = 0; i != num_key_files_; ++i) { 150 for (ptrdiff_t i = 0; i != num_key_files_; ++i) {
151 base::ScopedTempDir& backup_dir = key_backup_paths_[i]; 151 base::ScopedTempDir& backup_dir = key_backup_paths_[i];
152 if (!backup_dir.path().empty()) { 152 if (!backup_dir.path().empty()) {
153 base::FilePath& key_file = key_paths_[i]; 153 base::FilePath& key_file = key_paths_[i];
154 base::FilePath backup_file = 154 base::FilePath backup_file =
155 backup_dir.path().Append(key_file.BaseName()); 155 backup_dir.path().Append(key_file.BaseName());
156 if (file_util::PathExists(backup_file) && 156 if (file_util::PathExists(backup_file) &&
157 !file_util::Move(backup_file, key_file)) { 157 !base::Move(backup_file, key_file)) {
158 // This could happen if we could not delete the key file to begin with. 158 // This could happen if we could not delete the key file to begin with.
159 PLOG(WARNING) << "Rollback: Failed to move backup file back in place: " 159 PLOG(WARNING) << "Rollback: Failed to move backup file back in place: "
160 << backup_file.value() << " to " << key_file.value(); 160 << backup_file.value() << " to " << key_file.value();
161 } 161 }
162 } 162 }
163 } 163 }
164 } 164 }
OLDNEW
« no previous file with comments | « chrome/installer/util/copy_tree_work_item.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698