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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 KEY_QUERY_VALUE); | 218 KEY_QUERY_VALUE); |
219 | 219 |
220 string16 version_str; | 220 string16 version_str; |
221 if (result == ERROR_SUCCESS) | 221 if (result == ERROR_SUCCESS) |
222 result = key.ReadValue(google_update::kRegVersionField, &version_str); | 222 result = key.ReadValue(google_update::kRegVersionField, &version_str); |
223 | 223 |
224 *version = Version(); | 224 *version = Version(); |
225 if (result == ERROR_SUCCESS && !version_str.empty()) { | 225 if (result == ERROR_SUCCESS && !version_str.empty()) { |
226 VLOG(1) << "Existing " << dist->GetAppShortCutName() << " version found " | 226 VLOG(1) << "Existing " << dist->GetAppShortCutName() << " version found " |
227 << version_str; | 227 << version_str; |
228 *version = Version(WideToASCII(version_str)); | 228 *version = Version(base::WideToASCII(version_str)); |
229 } else { | 229 } else { |
230 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 230 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
231 VLOG(1) << "No existing " << dist->GetAppShortCutName() | 231 VLOG(1) << "No existing " << dist->GetAppShortCutName() |
232 << " install found."; | 232 << " install found."; |
233 } | 233 } |
234 } | 234 } |
235 | 235 |
236 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, | 236 void InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist, |
237 bool system_install, | 237 bool system_install, |
238 Version* version) { | 238 Version* version) { |
239 DCHECK(dist); | 239 DCHECK(dist); |
240 RegKey key; | 240 RegKey key; |
241 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; | 241 HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; |
242 LONG result = | 242 LONG result = |
243 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); | 243 key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_QUERY_VALUE); |
244 | 244 |
245 string16 version_str; | 245 string16 version_str; |
246 if (result == ERROR_SUCCESS) | 246 if (result == ERROR_SUCCESS) |
247 result = key.ReadValue(google_update::kRegCriticalVersionField, | 247 result = key.ReadValue(google_update::kRegCriticalVersionField, |
248 &version_str); | 248 &version_str); |
249 | 249 |
250 *version = Version(); | 250 *version = Version(); |
251 if (result == ERROR_SUCCESS && !version_str.empty()) { | 251 if (result == ERROR_SUCCESS && !version_str.empty()) { |
252 VLOG(1) << "Critical Update version for " << dist->GetAppShortCutName() | 252 VLOG(1) << "Critical Update version for " << dist->GetAppShortCutName() |
253 << " found " << version_str; | 253 << " found " << version_str; |
254 *version = Version(WideToASCII(version_str)); | 254 *version = Version(base::WideToASCII(version_str)); |
255 } else { | 255 } else { |
256 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 256 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
257 VLOG(1) << "No existing " << dist->GetAppShortCutName() | 257 VLOG(1) << "No existing " << dist->GetAppShortCutName() |
258 << " install found."; | 258 << " install found."; |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 bool InstallUtil::IsOSSupported() { | 262 bool InstallUtil::IsOSSupported() { |
263 // We do not support Win2K or older, or XP without service pack 2. | 263 // We do not support Win2K or older, or XP without service pack 2. |
264 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 264 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 // Open the program and see if it references the expected file. | 603 // Open the program and see if it references the expected file. |
604 base::win::ScopedHandle handle; | 604 base::win::ScopedHandle handle; |
605 BY_HANDLE_FILE_INFORMATION info = {}; | 605 BY_HANDLE_FILE_INFORMATION info = {}; |
606 | 606 |
607 return (OpenForInfo(path, &handle) && | 607 return (OpenForInfo(path, &handle) && |
608 GetInfo(handle, &info) && | 608 GetInfo(handle, &info) && |
609 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && | 609 info.dwVolumeSerialNumber == file_info_.dwVolumeSerialNumber && |
610 info.nFileIndexHigh == file_info_.nFileIndexHigh && | 610 info.nFileIndexHigh == file_info_.nFileIndexHigh && |
611 info.nFileIndexLow == file_info_.nFileIndexLow); | 611 info.nFileIndexLow == file_info_.nFileIndexLow); |
612 } | 612 } |
OLD | NEW |