OLD | NEW |
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/installer/util/delete_reg_value_work_item.h" | 5 #include "chrome/installer/util/delete_reg_value_work_item.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/win/registry.h" | 9 #include "base/win/registry.h" |
10 #include "chrome/installer/util/logging_installer.h" | 10 #include "chrome/installer/util/logging_installer.h" |
11 | 11 |
12 using base::win::RegKey; | 12 using base::win::RegKey; |
13 | 13 |
14 DeleteRegValueWorkItem::DeleteRegValueWorkItem(HKEY predefined_root, | 14 DeleteRegValueWorkItem::DeleteRegValueWorkItem(HKEY predefined_root, |
15 const std::wstring& key_path, | 15 const std::wstring& key_path, |
16 REGSAM wow64_access, | 16 REGSAM wow64_access, |
17 const std::wstring& value_name) | 17 const std::wstring& value_name) |
18 : predefined_root_(predefined_root), | 18 : predefined_root_(predefined_root), |
19 key_path_(key_path), | 19 key_path_(key_path), |
20 value_name_(value_name), | 20 value_name_(value_name), |
21 wow64_access_(wow64_access), | 21 wow64_access_(wow64_access), |
22 previous_type_(0), | 22 status_(DELETE_VALUE), |
23 status_(DELETE_VALUE) { | 23 previous_type_(0) { |
24 DCHECK(wow64_access == 0 || | 24 DCHECK(wow64_access == 0 || |
25 wow64_access == KEY_WOW64_32KEY || | 25 wow64_access == KEY_WOW64_32KEY || |
26 wow64_access == KEY_WOW64_64KEY); | 26 wow64_access == KEY_WOW64_64KEY); |
27 } | 27 } |
28 | 28 |
29 DeleteRegValueWorkItem::~DeleteRegValueWorkItem() { | 29 DeleteRegValueWorkItem::~DeleteRegValueWorkItem() { |
30 } | 30 } |
31 | 31 |
32 bool DeleteRegValueWorkItem::Do() { | 32 bool DeleteRegValueWorkItem::Do() { |
33 if (status_ != DELETE_VALUE) { | 33 if (status_ != DELETE_VALUE) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 const char* previous_value = | 98 const char* previous_value = |
99 previous_size ? &previous_value_[0] : NULL; | 99 previous_size ? &previous_value_[0] : NULL; |
100 result = key.WriteValue(value_name_.c_str(), previous_value, | 100 result = key.WriteValue(value_name_.c_str(), previous_value, |
101 previous_size, previous_type_); | 101 previous_size, previous_type_); |
102 VLOG_IF(1, result != ERROR_SUCCESS) << "rollback: restoring " | 102 VLOG_IF(1, result != ERROR_SUCCESS) << "rollback: restoring " |
103 << value_name_ << " error: " << result; | 103 << value_name_ << " error: " << result; |
104 } else { | 104 } else { |
105 VLOG(1) << "can not open " << key_path_ << " error: " << result; | 105 VLOG(1) << "can not open " << key_path_ << " error: " << result; |
106 } | 106 } |
107 } | 107 } |
OLD | NEW |