| 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/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| 11 #include "base/win/registry.h" | 11 #include "base/win/registry.h" |
| 12 #include "chrome/installer/util/browser_distribution.h" | 12 #include "chrome/installer/util/browser_distribution.h" |
| 13 #include "chrome/installer/util/google_update_constants.h" | 13 #include "chrome/installer/util/google_update_constants.h" |
| 14 #include "chrome/installer/util/install_util.h" | 14 #include "chrome/installer/util/install_util.h" |
| 15 #include "chrome/installer/util/util_constants.h" |
| 15 | 16 |
| 16 namespace installer { | 17 namespace installer { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // Initializes |commands| from the "Commands" subkey of |version_key|. Returns | 21 // Initializes |commands| from the "Commands" subkey of |version_key|. Returns |
| 21 // false if there is no "Commands" subkey or on error. | 22 // false if there is no "Commands" subkey or on error. |
| 22 bool InitializeCommands(const base::win::RegKey& version_key, | 23 bool InitializeCommands(const base::win::RegKey& version_key, |
| 23 AppCommands* commands) { | 24 AppCommands* commands) { |
| 24 static const DWORD kAccess = | 25 static const DWORD kAccess = |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 &oem_install_) == ERROR_SUCCESS); | 111 &oem_install_) == ERROR_SUCCESS); |
| 111 // "eulaaccepted" may be absent, 0 or 1. | 112 // "eulaaccepted" may be absent, 0 or 1. |
| 112 has_eula_accepted_ = (key.ReadValueDW(google_update::kRegEULAAceptedField, | 113 has_eula_accepted_ = (key.ReadValueDW(google_update::kRegEULAAceptedField, |
| 113 &eula_accepted_) == ERROR_SUCCESS); | 114 &eula_accepted_) == ERROR_SUCCESS); |
| 114 // "msi" may be absent, 0 or 1 | 115 // "msi" may be absent, 0 or 1 |
| 115 DWORD dw_value = 0; | 116 DWORD dw_value = 0; |
| 116 msi_ = (key.ReadValueDW(google_update::kRegMSIField, | 117 msi_ = (key.ReadValueDW(google_update::kRegMSIField, |
| 117 &dw_value) == ERROR_SUCCESS) && (dw_value != 0); | 118 &dw_value) == ERROR_SUCCESS) && (dw_value != 0); |
| 118 // Multi-install is a legacy option that is read for the sole purpose of | 119 // Multi-install is a legacy option that is read for the sole purpose of |
| 119 // migrating clients away from it. | 120 // migrating clients away from it. |
| 120 multi_install_ = uninstall_command_.HasSwitch(switches::kMultiInstall); | 121 multi_install_ = uninstall_command_.HasSwitch("multi-install"); |
| 121 } | 122 } |
| 122 | 123 |
| 123 // Read from the ClientStateMedium key. Values here override those in | 124 // Read from the ClientStateMedium key. Values here override those in |
| 124 // ClientState. | 125 // ClientState. |
| 125 if (system_install && | 126 if (system_install && |
| 126 key.Open(root_key, distribution->GetStateMediumKey().c_str(), kAccess) == | 127 key.Open(root_key, distribution->GetStateMediumKey().c_str(), kAccess) == |
| 127 ERROR_SUCCESS) { | 128 ERROR_SUCCESS) { |
| 128 DWORD dword_value = 0; | 129 DWORD dword_value = 0; |
| 129 | 130 |
| 130 if (key.ReadValueDW(google_update::kRegUsageStatsField, | 131 if (key.ReadValueDW(google_update::kRegUsageStatsField, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 GetNonVersionedProductState(system_install); | 231 GetNonVersionedProductState(system_install); |
| 231 return product_state->version_.get() ? product_state : nullptr; | 232 return product_state->version_.get() ? product_state : nullptr; |
| 232 } | 233 } |
| 233 | 234 |
| 234 const ProductState* InstallationState::GetNonVersionedProductState( | 235 const ProductState* InstallationState::GetNonVersionedProductState( |
| 235 bool system_install) const { | 236 bool system_install) const { |
| 236 return system_install ? &system_chrome_ : &user_chrome_; | 237 return system_install ? &system_chrome_ : &user_chrome_; |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace installer | 240 } // namespace installer |
| OLD | NEW |