| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 bool system_install, BrowserDistribution::Type distribution_type) { | 207 bool system_install, BrowserDistribution::Type distribution_type) { |
| 208 ProductState state; | 208 ProductState state; |
| 209 if (state.Initialize(system_install, distribution_type)) { | 209 if (state.Initialize(system_install, distribution_type)) { |
| 210 return state.uninstall_command(); | 210 return state.uninstall_command(); |
| 211 } | 211 } |
| 212 return CommandLine(CommandLine::NO_PROGRAM); | 212 return CommandLine(CommandLine::NO_PROGRAM); |
| 213 } | 213 } |
| 214 | 214 |
| 215 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, | 215 void InstallUtil::GetChromeVersion(BrowserDistribution* dist, |
| 216 bool system_install, | 216 bool system_install, |
| 217 base::Version* version) { | 217 Version* version) { |
| 218 DCHECK(dist); | 218 DCHECK(dist); |
| 219 RegKey key; | 219 RegKey key; |
| 220 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 220 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 221 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), | 221 LONG result = key.Open(reg_root, dist->GetVersionKey().c_str(), |
| 222 KEY_QUERY_VALUE); | 222 KEY_QUERY_VALUE); |
| 223 | 223 |
| 224 base::string16 version_str; | 224 base::string16 version_str; |
| 225 if (result == ERROR_SUCCESS) | 225 if (result == ERROR_SUCCESS) |
| 226 result = key.ReadValue(google_update::kRegVersionField, &version_str); | 226 result = key.ReadValue(google_update::kRegVersionField, &version_str); |
| 227 | 227 |
| 228 *version = base::Version(); | 228 *version = Version(); |
| 229 if (result == ERROR_SUCCESS && !version_str.empty()) { | 229 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 230 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " | 230 VLOG(1) << "Existing " << dist->GetDisplayName() << " version found " |
| 231 << version_str; | 231 << version_str; |
| 232 *version = base::Version(WideToASCII(version_str)); | 232 *version = Version(WideToASCII(version_str)); |
| 233 } else { | 233 } else { |
| 234 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 234 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 235 VLOG(1) << "No existing " << dist->GetDisplayName() | 235 VLOG(1) << "No existing " << dist->GetDisplayName() |
| 236 << " install found."; | 236 << " install found."; |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, | 240 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, |
| 241 bool system_install, | 241 bool system_install, |
| 242 base::Version* version) { | 242 Version* version) { |
| 243 DCHECK(dist); | 243 DCHECK(dist); |
| 244 RegKey key; | 244 RegKey key; |
| 245 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 245 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
| 246 LONG result = | 246 LONG result = |
| 247 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); | 247 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); |
| 248 | 248 |
| 249 base::string16 version_str; | 249 base::string16 version_str; |
| 250 if (result == ERROR_SUCCESS) | 250 if (result == ERROR_SUCCESS) |
| 251 result = key.ReadValue(google_update::kRegCriticalVersionField, | 251 result = key.ReadValue(google_update::kRegCriticalVersionField, |
| 252 &version_str); | 252 &version_str); |
| 253 | 253 |
| 254 *version = base::Version(); | 254 *version = Version(); |
| 255 if (result == ERROR_SUCCESS && !version_str.empty()) { | 255 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 256 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() | 256 VLOG(1) << "Critical Update version for " << dist->GetDisplayName() |
| 257 << " found " << version_str; | 257 << " found " << version_str; |
| 258 *version = base::Version(WideToASCII(version_str)); | 258 *version = Version(WideToASCII(version_str)); |
| 259 } else { | 259 } else { |
| 260 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 260 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 261 VLOG(1) << "No existing " << dist->GetDisplayName() | 261 VLOG(1) << "No existing " << dist->GetDisplayName() |
| 262 << " install found."; | 262 << " install found."; |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 bool InstallUtil::IsOSSupported() { | 266 bool InstallUtil::IsOSSupported() { |
| 267 // We do not support Win2K or older, or XP without service pack 2. | 267 // We do not support Win2K or older, or XP without service pack 2. |
| 268 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 268 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // Open the program and see if it references the expected file. | 626 // Open the program and see if it references the expected file. |
| 627 base::win::ScopedHandle handle; | 627 base::win::ScopedHandle handle; |
| 628 BY_HANDLE_FILE_INFORMATION info = {}; | 628 BY_HANDLE_FILE_INFORMATION info = {}; |
| 629 | 629 |
| 630 return (OpenForInfo(path, &handle) && | 630 return (OpenForInfo(path, &handle) && |
| 631 GetInfo(handle, &info) && | 631 GetInfo(handle, &info) && |
| 632 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 632 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
| 633 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 633 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
| 634 info.nFileIndexLow == file_info_.nFileIndexLow); | 634 info.nFileIndexLow == file_info_.nFileIndexLow); |
| 635 } | 635 } |
| OLD | NEW |