| 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 // See the corresponding header file for description of the functions in this | 5 // See the corresponding header file for description of the functions in this |
| 6 // file. | 6 // file. |
| 7 | 7 |
| 8 #include "chrome/installer/util/install_util.h" | 8 #include "chrome/installer/util/install_util.h" |
| 9 | 9 |
| 10 #include <shellapi.h> | 10 #include <shellapi.h> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 BrowserDistribution::Type distribution_type) { | 168 BrowserDistribution::Type distribution_type) { |
| 169 ProductState state; | 169 ProductState state; |
| 170 if (state.Initialize(system_install, distribution_type)) { | 170 if (state.Initialize(system_install, distribution_type)) { |
| 171 return state.uninstall_command(); | 171 return state.uninstall_command(); |
| 172 } | 172 } |
| 173 return base::CommandLine(base::CommandLine::NO_PROGRAM); | 173 return base::CommandLine(base::CommandLine::NO_PROGRAM); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, | 176 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, |
| 177 bool system_install, | 177 bool system_install, |
| 178 Version* version) { | 178 base::Version* version) { |
| 179 DCHECK(dist); | 179 DCHECK(dist); |
| 180 RegKey key; | 180 RegKey key; |
| 181 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 181 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 182 LONG result = key.Open(reg_root, | 182 LONG result = key.Open(reg_root, |
| 183 dist->GetVersionKey().c_str(), | 183 dist->GetVersionKey().c_str(), |
| 184 KEY_QUERY_VALUE | KEY_WOW64_32KEY); | 184 KEY_QUERY_VALUE | KEY_WOW64_32KEY); |
| 185 | 185 |
| 186 base::string16 version_str; | 186 base::string16 version_str; |
| 187 if (result == ERROR_SUCCESS) | 187 if (result == ERROR_SUCCESS) |
| 188 result = key.ReadValue(google_update::kRegVersionField, &version_str); | 188 result = key.ReadValue(google_update::kRegVersionField, &version_str); |
| 189 | 189 |
| 190 *version = Version(); | 190 *version = base::Version(); |
| 191 if (result == ERROR_SUCCESS && !version_str.empty()) { | 191 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 192 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " | 192 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " |
| 193 << version_str; | 193 << version_str; |
| 194 *version = Version(base::UTF16ToASCII(version_str)); | 194 *version = base::Version(base::UTF16ToASCII(version_str)); |
| 195 } else { | 195 } else { |
| 196 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 196 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 197 VLOG(1) << "No existing " << dist->GetDisplayName() | 197 VLOG(1) << "No existing " << dist->GetDisplayName() |
| 198 << " install found."; | 198 << " install found."; |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, | 202 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, |
| 203 bool system_install, | 203 bool system_install, |
| 204 Version* version) { | 204 base::Version* version) { |
| 205 DCHECK(dist); | 205 DCHECK(dist); |
| 206 RegKey key; | 206 RegKey key; |
| 207 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 207 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 208 LONG result = key.Open(reg_root, | 208 LONG result = key.Open(reg_root, |
| 209 dist->GetVersionKey().c_str(), | 209 dist->GetVersionKey().c_str(), |
| 210 KEY_QUERY_VALUE | KEY_WOW64_32KEY); | 210 KEY_QUERY_VALUE | KEY_WOW64_32KEY); |
| 211 | 211 |
| 212 base::string16 version_str; | 212 base::string16 version_str; |
| 213 if (result == ERROR_SUCCESS) | 213 if (result == ERROR_SUCCESS) |
| 214 result = key.ReadValue(google_update::kRegCriticalVersionField, | 214 result = key.ReadValue(google_update::kRegCriticalVersionField, |
| 215 &version_str); | 215 &version_str); |
| 216 | 216 |
| 217 *version = Version(); | 217 *version = base::Version(); |
| 218 if (result == ERROR_SUCCESS && !version_str.empty()) { | 218 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 219 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() | 219 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() |
| 220 << " found " << version_str; | 220 << " found " << version_str; |
| 221 *version = Version(base::UTF16ToASCII(version_str)); | 221 *version = base::Version(base::UTF16ToASCII(version_str)); |
| 222 } else { | 222 } else { |
| 223 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 223 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 224 VLOG(1) << "No existing " << dist->GetDisplayName() | 224 VLOG(1) << "No existing " << dist->GetDisplayName() |
| 225 << " install found."; | 225 << " install found."; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool InstallUtil::IsOSSupported() { | 229 bool InstallUtil::IsOSSupported() { |
| 230 // We do not support anything prior to Windows 7. | 230 // We do not support anything prior to Windows 7. |
| 231 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 231 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 672 |
| 673 // Open the program and see if it references the expected file. | 673 // Open the program and see if it references the expected file. |
| 674 base::File file; | 674 base::File file; |
| 675 BY_HANDLE_FILE_INFORMATION info = {}; | 675 BY_HANDLE_FILE_INFORMATION info = {}; |
| 676 | 676 |
| 677 return (OpenForInfo(path, &file, comparison_type_) && GetInfo(file, &info) && | 677 return (OpenForInfo(path, &file, comparison_type_) && GetInfo(file, &info) && |
| 678 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 678 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 679 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 679 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 680 info.nFileIndexLow == file_info_.nFileIndexLow); | 680 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 681 } | 681 } |
| OLD | NEW |