| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // "UninstallString" will be absent for the multi-installer package. | 91 // "UninstallString" will be absent for the multi-installer package. |
| 92 key.ReadValue(kUninstallStringField, &setup_path); | 92 key.ReadValue(kUninstallStringField, &setup_path); |
| 93 // "UninstallArguments" will be absent for the multi-installer package. | 93 // "UninstallArguments" will be absent for the multi-installer package. |
| 94 key.ReadValue(kUninstallArgumentsField, &uninstall_arguments); | 94 key.ReadValue(kUninstallArgumentsField, &uninstall_arguments); |
| 95 InstallUtil::MakeUninstallCommand(setup_path, uninstall_arguments, | 95 InstallUtil::MakeUninstallCommand(setup_path, uninstall_arguments, |
| 96 &uninstall_command_); | 96 &uninstall_command_); |
| 97 | 97 |
| 98 // "usagestats" may be absent, 0 (false), or 1 (true). On the chance that | 98 // "usagestats" may be absent, 0 (false), or 1 (true). On the chance that |
| 99 // different values are permitted in the future, we'll simply hold whatever | 99 // different values are permitted in the future, we'll simply hold whatever |
| 100 // we find. | 100 // we find. |
| 101 has_usagestats_ = (key.ReadValueDW(google_update::kRegUsageStatsField, | 101 has_usagestats_ = (key.ReadValue(google_update::kRegUsageStatsField, |
| 102 &usagestats_) == ERROR_SUCCESS); | 102 &usagestats_) == ERROR_SUCCESS); |
| 103 // "oeminstall" may be present with any value or absent. | 103 // "oeminstall" may be present with any value or absent. |
| 104 has_oem_install_ = (key.ReadValue(google_update::kRegOemInstallField, | 104 has_oem_install_ = (key.ReadValue(google_update::kRegOemInstallField, |
| 105 &oem_install_) == ERROR_SUCCESS); | 105 &oem_install_) == ERROR_SUCCESS); |
| 106 // "eulaaccepted" may be absent, 0 or 1. | 106 // "eulaaccepted" may be absent, 0 or 1. |
| 107 has_eula_accepted_ = (key.ReadValueDW(google_update::kRegEULAAceptedField, | 107 has_eula_accepted_ = (key.ReadValue(google_update::kRegEULAAceptedField, |
| 108 &eula_accepted_) == ERROR_SUCCESS); | 108 &eula_accepted_) == ERROR_SUCCESS); |
| 109 // "msi" may be absent, 0 or 1 | 109 // "msi" may be absent, 0 or 1 |
| 110 DWORD dw_value = 0; | 110 DWORD dw_value = 0; |
| 111 msi_ = (key.ReadValueDW(google_update::kRegMSIField, | 111 msi_ = (key.ReadValue(google_update::kRegMSIField, |
| 112 &dw_value) == ERROR_SUCCESS) && (dw_value != 0); | 112 &dw_value) == ERROR_SUCCESS) && (dw_value != 0); |
| 113 // Multi-install is implied or is derived from the command-line. | 113 // Multi-install is implied or is derived from the command-line. |
| 114 if (distribution->GetType() == BrowserDistribution::CHROME_BINARIES) | 114 if (distribution->GetType() == BrowserDistribution::CHROME_BINARIES) |
| 115 multi_install_ = true; | 115 multi_install_ = true; |
| 116 else | 116 else |
| 117 multi_install_ = uninstall_command_.HasSwitch(switches::kMultiInstall); | 117 multi_install_ = uninstall_command_.HasSwitch(switches::kMultiInstall); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Read from the ClientStateMedium key. Values here override those in | 120 // Read from the ClientStateMedium key. Values here override those in |
| 121 // ClientState. | 121 // ClientState. |
| 122 if (system_install && | 122 if (system_install && |
| 123 key.Open(root_key, distribution->GetStateMediumKey().c_str(), | 123 key.Open(root_key, distribution->GetStateMediumKey().c_str(), |
| 124 KEY_QUERY_VALUE) == ERROR_SUCCESS) { | 124 KEY_QUERY_VALUE) == ERROR_SUCCESS) { |
| 125 DWORD dword_value = 0; | 125 DWORD dword_value = 0; |
| 126 | 126 |
| 127 if (key.ReadValueDW(google_update::kRegUsageStatsField, | 127 if (key.ReadValue(google_update::kRegUsageStatsField, |
| 128 &dword_value) == ERROR_SUCCESS) { | 128 &dword_value) == ERROR_SUCCESS) { |
| 129 has_usagestats_ = true; | 129 has_usagestats_ = true; |
| 130 usagestats_ = dword_value; | 130 usagestats_ = dword_value; |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (key.ReadValueDW(google_update::kRegEULAAceptedField, | 133 if (key.ReadValue(google_update::kRegEULAAceptedField, |
| 134 &dword_value) == ERROR_SUCCESS) { | 134 &dword_value) == ERROR_SUCCESS) { |
| 135 has_eula_accepted_ = true; | 135 has_eula_accepted_ = true; |
| 136 eula_accepted_ = dword_value; | 136 eula_accepted_ = dword_value; |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 return version_.get() != NULL; | 140 return version_.get() != NULL; |
| 141 } | 141 } |
| 142 | 142 |
| 143 FilePath ProductState::GetSetupPath() const { | 143 FilePath ProductState::GetSetupPath() const { |
| 144 return uninstall_command_.GetProgram(); | 144 return uninstall_command_.GetProgram(); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 | 258 |
| 259 const ProductState* InstallationState::GetProductState( | 259 const ProductState* InstallationState::GetProductState( |
| 260 bool system_install, | 260 bool system_install, |
| 261 BrowserDistribution::Type type) const { | 261 BrowserDistribution::Type type) const { |
| 262 const ProductState* product_state = | 262 const ProductState* product_state = |
| 263 GetNonVersionedProductState(system_install, type); | 263 GetNonVersionedProductState(system_install, type); |
| 264 return product_state->version_.get() == NULL ? NULL : product_state; | 264 return product_state->version_.get() == NULL ? NULL : product_state; |
| 265 } | 265 } |
| 266 } // namespace installer | 266 } // namespace installer |
| OLD | NEW |