Chromium Code Reviews| 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" |
| 11 #include "chrome/installer/util/google_update_constants.h" | 11 #include "chrome/installer/util/google_update_constants.h" |
| 12 #include "chrome/installer/util/package_properties.h" | 12 #include "chrome/installer/util/package_properties.h" |
| 13 | 13 |
| 14 namespace installer { | 14 namespace installer { |
| 15 | 15 |
| 16 ProductState::ProductState() { | 16 ProductState::ProductState() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void ProductState::Initialize(bool system_install, | 19 void ProductState::Initialize(bool system_install, |
| 20 const std::wstring& version_key, | 20 const std::wstring& version_key, |
| 21 const std::wstring& state_key) { | 21 const std::wstring& state_key) { |
| 22 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 22 const HKEY root_key = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 23 base::win::RegKey key(root_key, version_key.c_str(), KEY_QUERY_VALUE); | 23 base::win::RegKey key(root_key, version_key.c_str(), KEY_QUERY_VALUE); |
| 24 std::wstring version_str; | 24 std::wstring version_str; |
| 25 if (key.ReadValue(google_update::kRegVersionField, &version_str)) { | 25 if (key.ReadValue(google_update::kRegVersionField, &version_str) |
| 26 == ERROR_SUCCESS) { | |
|
grt (UTC plus 2)
2011/01/16 04:19:48
Wrapping
amit
2011/01/16 07:54:28
Done.
| |
| 26 version_.reset(Version::GetVersionFromString(WideToASCII(version_str))); | 27 version_.reset(Version::GetVersionFromString(WideToASCII(version_str))); |
| 27 if (version_.get() != NULL) { | 28 if (version_.get() != NULL) { |
| 28 // The product is installed. Check for the channel value (absent if not | 29 // The product is installed. Check for the channel value (absent if not |
| 29 // installed/managed by Google Update). | 30 // installed/managed by Google Update). |
| 30 if (!key.Open(root_key, state_key.c_str(), KEY_QUERY_VALUE) || | 31 if (key.Open(root_key, state_key.c_str(), KEY_QUERY_VALUE) |
| 31 !channel_.Initialize(key)) { | 32 != ERROR_SUCCESS || !channel_.Initialize(key)) { |
|
grt (UTC plus 2)
2011/01/16 04:19:48
Wrapping (plus extra parens around the first part?
amit
2011/01/16 07:54:28
Done.
| |
| 32 channel_.set_value(std::wstring()); | 33 channel_.set_value(std::wstring()); |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 } else { | 36 } else { |
| 36 version_.reset(); | 37 version_.reset(); |
| 37 } | 38 } |
| 38 } | 39 } |
| 39 | 40 |
| 40 const Version& ProductState::version() const { | 41 const Version& ProductState::version() const { |
| 41 DCHECK(version_.get() != NULL); | 42 DCHECK(version_.get() != NULL); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 111 |
| 111 const ProductState* InstallationState::GetProductState( | 112 const ProductState* InstallationState::GetProductState( |
| 112 bool system_install, | 113 bool system_install, |
| 113 BrowserDistribution::Type type) const { | 114 BrowserDistribution::Type type) const { |
| 114 const ProductState& product_state = (system_install ? system_products_ : | 115 const ProductState& product_state = (system_install ? system_products_ : |
| 115 user_products_)[IndexFromDistType(type)]; | 116 user_products_)[IndexFromDistType(type)]; |
| 116 return product_state.version_.get() == NULL ? NULL : &product_state; | 117 return product_state.version_.get() == NULL ? NULL : &product_state; |
| 117 } | 118 } |
| 118 | 119 |
| 119 } // namespace installer | 120 } // namespace installer |
| OLD | NEW |