| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/registry.h" | 5 #include "base/registry.h" |
| 6 #include "chrome/installer/util/set_reg_value_work_item.h" | 6 #include "chrome/installer/util/set_reg_value_work_item.h" |
| 7 #include "chrome/installer/util/logging_installer.h" | 7 #include "chrome/installer/util/logging_installer.h" |
| 8 | 8 |
| 9 SetRegValueWorkItem::~SetRegValueWorkItem() { | 9 SetRegValueWorkItem::~SetRegValueWorkItem() { |
| 10 } | 10 } |
| 11 | 11 |
| 12 SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root, | 12 SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root, |
| 13 std::wstring key_path, | 13 const std::wstring& key_path, |
| 14 std::wstring value_name, | 14 const std::wstring& value_name, |
| 15 std::wstring value_data, | 15 const std::wstring& value_data, |
| 16 bool overwrite) | 16 bool overwrite) |
| 17 : predefined_root_(predefined_root), | 17 : predefined_root_(predefined_root), |
| 18 key_path_(key_path), | 18 key_path_(key_path), |
| 19 value_name_(value_name), | 19 value_name_(value_name), |
| 20 value_data_str_(value_data), | 20 value_data_str_(value_data), |
| 21 value_data_dword_(0), |
| 21 overwrite_(overwrite), | 22 overwrite_(overwrite), |
| 22 status_(SET_VALUE), | 23 status_(SET_VALUE), |
| 23 is_str_type_(true) { | 24 is_str_type_(true), |
| 25 previous_value_dword_(0) { |
| 24 } | 26 } |
| 25 | 27 |
| 26 SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root, | 28 SetRegValueWorkItem::SetRegValueWorkItem(HKEY predefined_root, |
| 27 std::wstring key_path, | 29 const std::wstring& key_path, |
| 28 std::wstring value_name, | 30 const std::wstring& value_name, |
| 29 DWORD value_data, | 31 DWORD value_data, |
| 30 bool overwrite) | 32 bool overwrite) |
| 31 : predefined_root_(predefined_root), | 33 : predefined_root_(predefined_root), |
| 32 key_path_(key_path), | 34 key_path_(key_path), |
| 33 value_name_(value_name), | 35 value_name_(value_name), |
| 34 value_data_dword_(value_data), | 36 value_data_dword_(value_data), |
| 35 overwrite_(overwrite), | 37 overwrite_(overwrite), |
| 36 status_(SET_VALUE), | 38 status_(SET_VALUE), |
| 37 is_str_type_(false) { | 39 is_str_type_(false), |
| 40 previous_value_dword_(0) { |
| 38 } | 41 } |
| 39 | 42 |
| 40 bool SetRegValueWorkItem::Do() { | 43 bool SetRegValueWorkItem::Do() { |
| 41 if (status_ != SET_VALUE) { | 44 if (status_ != SET_VALUE) { |
| 42 // we already did something. | 45 // we already did something. |
| 43 LOG(ERROR) << "multiple calls to Do()"; | 46 LOG(ERROR) << "multiple calls to Do()"; |
| 44 return false; | 47 return false; |
| 45 } | 48 } |
| 46 | 49 |
| 47 RegKey key; | 50 RegKey key; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 result_str.assign(L" succeeded"); | 145 result_str.assign(L" succeeded"); |
| 143 LOG(INFO) << "rollback: restoring " << value_name_ << result_str; | 146 LOG(INFO) << "rollback: restoring " << value_name_ << result_str; |
| 144 } else { | 147 } else { |
| 145 // Not reached. | 148 // Not reached. |
| 146 } | 149 } |
| 147 | 150 |
| 148 status_ = VALUE_ROLL_BACK; | 151 status_ = VALUE_ROLL_BACK; |
| 149 key.Close(); | 152 key.Close(); |
| 150 return; | 153 return; |
| 151 } | 154 } |
| OLD | NEW |