OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/installation_state.h" | 5 #include "chrome/installer/util/installation_state.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/version.h" | 9 #include "base/version.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (key.ReadValue(google_update::kRegOldVersionField, | 40 if (key.ReadValue(google_update::kRegOldVersionField, |
41 &version_str) == ERROR_SUCCESS) { | 41 &version_str) == ERROR_SUCCESS) { |
42 old_version_.reset( | 42 old_version_.reset( |
43 Version::GetVersionFromString(WideToASCII(version_str))); | 43 Version::GetVersionFromString(WideToASCII(version_str))); |
44 } else { | 44 } else { |
45 old_version_.reset(); | 45 old_version_.reset(); |
46 } | 46 } |
47 if (key.ReadValue(google_update::kRegRenameCmdField, | 47 if (key.ReadValue(google_update::kRegRenameCmdField, |
48 &rename_cmd_) != ERROR_SUCCESS) | 48 &rename_cmd_) != ERROR_SUCCESS) |
49 rename_cmd_.clear(); | 49 rename_cmd_.clear(); |
| 50 if (!commands_.Initialize(key)) |
| 51 commands_.Clear(); |
50 // Read from the ClientState key. | 52 // Read from the ClientState key. |
51 channel_.set_value(std::wstring()); | 53 channel_.set_value(std::wstring()); |
52 uninstall_command_ = CommandLine(CommandLine::NO_PROGRAM); | 54 uninstall_command_ = CommandLine(CommandLine::NO_PROGRAM); |
53 msi_ = false; | 55 msi_ = false; |
54 multi_install_ = false; | 56 multi_install_ = false; |
55 if (key.Open(root_key, state_key.c_str(), | 57 if (key.Open(root_key, state_key.c_str(), |
56 KEY_QUERY_VALUE) == ERROR_SUCCESS) { | 58 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
57 std::wstring setup_path; | 59 std::wstring setup_path; |
58 std::wstring uninstall_arguments; | 60 std::wstring uninstall_arguments; |
59 // "ap" will be absent if not managed by Google Update. | 61 // "ap" will be absent if not managed by Google Update. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return *version_; | 94 return *version_; |
93 } | 95 } |
94 | 96 |
95 ProductState& ProductState::CopyFrom(const ProductState& other) { | 97 ProductState& ProductState::CopyFrom(const ProductState& other) { |
96 channel_.set_value(other.channel_.value()); | 98 channel_.set_value(other.channel_.value()); |
97 version_.reset(other.version_.get() == NULL ? NULL : other.version_->Clone()); | 99 version_.reset(other.version_.get() == NULL ? NULL : other.version_->Clone()); |
98 old_version_.reset( | 100 old_version_.reset( |
99 other.old_version_.get() == NULL ? NULL : other.old_version_->Clone()); | 101 other.old_version_.get() == NULL ? NULL : other.old_version_->Clone()); |
100 rename_cmd_ = other.rename_cmd_; | 102 rename_cmd_ = other.rename_cmd_; |
101 uninstall_command_ = other.uninstall_command_; | 103 uninstall_command_ = other.uninstall_command_; |
| 104 commands_.CopyFrom(other.commands_); |
102 msi_ = other.msi_; | 105 msi_ = other.msi_; |
103 multi_install_ = other.multi_install_; | 106 multi_install_ = other.multi_install_; |
104 | 107 |
105 return *this; | 108 return *this; |
106 } | 109 } |
107 | 110 |
108 InstallationState::InstallationState() { | 111 InstallationState::InstallationState() { |
109 } | 112 } |
110 | 113 |
111 // static | 114 // static |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 146 |
144 const ProductState* InstallationState::GetProductState( | 147 const ProductState* InstallationState::GetProductState( |
145 bool system_install, | 148 bool system_install, |
146 BrowserDistribution::Type type) const { | 149 BrowserDistribution::Type type) const { |
147 const ProductState& product_state = (system_install ? system_products_ : | 150 const ProductState& product_state = (system_install ? system_products_ : |
148 user_products_)[IndexFromDistType(type)]; | 151 user_products_)[IndexFromDistType(type)]; |
149 return product_state.version_.get() == NULL ? NULL : &product_state; | 152 return product_state.version_.get() == NULL ? NULL : &product_state; |
150 } | 153 } |
151 | 154 |
152 } // namespace installer | 155 } // namespace installer |
OLD | NEW |