| Index: chrome/installer/util/delete_reg_key_work_item.cc
|
| diff --git a/chrome/installer/util/delete_reg_key_work_item.cc b/chrome/installer/util/delete_reg_key_work_item.cc
|
| index c0e13d99b3ab3d6a352f49ee6884f0cf64bb7128..9f482311037ffe99013136d97d75e2a730913278 100644
|
| --- a/chrome/installer/util/delete_reg_key_work_item.cc
|
| +++ b/chrome/installer/util/delete_reg_key_work_item.cc
|
| @@ -29,32 +29,34 @@
|
| wow64_access == KEY_WOW64_64KEY);
|
| }
|
|
|
| -bool DeleteRegKeyWorkItem::DoImpl() {
|
| - DCHECK(!backup_initialized_);
|
| -
|
| +bool DeleteRegKeyWorkItem::Do() {
|
| if (path_.empty())
|
| return false;
|
|
|
| - // Only try to make a backup if rollback is enabled.
|
| - if (rollback_enabled()) {
|
| - if (!backup_.Initialize(predefined_root_, path_.c_str(), wow64_access_)) {
|
| + RegistryKeyBackup backup;
|
| +
|
| + // Only try to make a backup if we're not configured to ignore failures.
|
| + if (!ignore_failure_) {
|
| + if (!backup.Initialize(predefined_root_, path_.c_str(), wow64_access_)) {
|
| LOG(ERROR) << "Failed to backup destination for registry key copy.";
|
| return false;
|
| }
|
| - backup_initialized_ = true;
|
| }
|
|
|
| // Delete the key.
|
| if (!InstallUtil::DeleteRegistryKey(
|
| predefined_root_, path_.c_str(), wow64_access_)) {
|
| - return false;
|
| + return ignore_failure_;
|
| }
|
| +
|
| + // We've succeeded, so remember any backup we may have made.
|
| + backup_.swap(backup);
|
|
|
| return true;
|
| }
|
|
|
| -void DeleteRegKeyWorkItem::RollbackImpl() {
|
| - if (!backup_initialized_)
|
| +void DeleteRegKeyWorkItem::Rollback() {
|
| + if (ignore_failure_)
|
| return;
|
|
|
| // Delete anything in the key before restoring the backup in case someone else
|
|
|