| 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/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Clear the runway. | 54 // Clear the runway. |
| 55 Clear(); | 55 Clear(); |
| 56 | 56 |
| 57 // Read from the Clients key. | 57 // Read from the Clients key. |
| 58 if (key.Open(root_key, version_key.c_str(), | 58 if (key.Open(root_key, version_key.c_str(), |
| 59 KEY_QUERY_VALUE) == ERROR_SUCCESS) { | 59 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
| 60 std::wstring version_str; | 60 std::wstring version_str; |
| 61 if (key.ReadValue(google_update::kRegVersionField, | 61 if (key.ReadValue(google_update::kRegVersionField, |
| 62 &version_str) == ERROR_SUCCESS) { | 62 &version_str) == ERROR_SUCCESS) { |
| 63 version_.reset(new Version(WideToASCII(version_str))); | 63 version_.reset(new Version(base::WideToASCII(version_str))); |
| 64 if (!version_->IsValid()) | 64 if (!version_->IsValid()) |
| 65 version_.reset(); | 65 version_.reset(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Attempt to read the other values even if the "pv" version value was | 68 // Attempt to read the other values even if the "pv" version value was |
| 69 // absent. Note that ProductState instances containing these values will | 69 // absent. Note that ProductState instances containing these values will |
| 70 // only be accessible via InstallationState::GetNonVersionedProductState. | 70 // only be accessible via InstallationState::GetNonVersionedProductState. |
| 71 if (key.ReadValue(google_update::kRegOldVersionField, | 71 if (key.ReadValue(google_update::kRegOldVersionField, |
| 72 &version_str) == ERROR_SUCCESS) { | 72 &version_str) == ERROR_SUCCESS) { |
| 73 old_version_.reset(new Version(WideToASCII(version_str))); | 73 old_version_.reset(new Version(base::WideToASCII(version_str))); |
| 74 if (!old_version_->IsValid()) | 74 if (!old_version_->IsValid()) |
| 75 old_version_.reset(); | 75 old_version_.reset(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_); | 78 key.ReadValue(google_update::kRegRenameCmdField, &rename_cmd_); |
| 79 if (!InitializeCommands(key, &commands_)) | 79 if (!InitializeCommands(key, &commands_)) |
| 80 commands_.Clear(); | 80 commands_.Clear(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 // Read from the ClientState key. | 83 // Read from the ClientState key. |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 const ProductState* InstallationState::GetProductState( | 270 const ProductState* InstallationState::GetProductState( |
| 271 bool system_install, | 271 bool system_install, |
| 272 BrowserDistribution::Type type) const { | 272 BrowserDistribution::Type type) const { |
| 273 const ProductState* product_state = | 273 const ProductState* product_state = |
| 274 GetNonVersionedProductState(system_install, type); | 274 GetNonVersionedProductState(system_install, type); |
| 275 return product_state->version_.get() == NULL ? NULL : product_state; | 275 return product_state->version_.get() == NULL ? NULL : product_state; |
| 276 } | 276 } |
| 277 } // namespace installer | 277 } // namespace installer |
| OLD | NEW |