| 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 // 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ret = Version::GetVersionFromString(WideToASCII(version_str)); | 186 ret = Version::GetVersionFromString(WideToASCII(version_str)); |
| 187 } else { | 187 } else { |
| 188 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); | 188 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 189 VLOG(1) << "No existing " << dist->GetApplicationName() | 189 VLOG(1) << "No existing " << dist->GetApplicationName() |
| 190 << " install found."; | 190 << " install found."; |
| 191 } | 191 } |
| 192 | 192 |
| 193 return ret; | 193 return ret; |
| 194 } | 194 } |
| 195 | 195 |
| 196 Version* InstallUtil::GetCriticalUpdateVersion(BrowserDistribution* dist) { |
| 197 DCHECK(dist); |
| 198 RegKey key; |
| 199 LONG result = |
| 200 key.Open(HKEY_CURRENT_USER, dist->GetVersionKey().c_str(), KEY_READ); |
| 201 |
| 202 string16 version_str; |
| 203 if (result == ERROR_SUCCESS) |
| 204 result = key.ReadValue(google_update::kRegCriticalUpdateField, |
| 205 &version_str); |
| 206 |
| 207 Version* ret = NULL; |
| 208 if (result == ERROR_SUCCESS && !version_str.empty()) { |
| 209 VLOG(1) << "Critical Update version for " << dist->GetApplicationName() |
| 210 << " found " << version_str; |
| 211 ret = Version::GetVersionFromString(WideToASCII(version_str)); |
| 212 } else { |
| 213 DCHECK_EQ(ERROR_FILE_NOT_FOUND, result); |
| 214 VLOG(1) << "No existing " << dist->GetApplicationName() |
| 215 << " install found."; |
| 216 } |
| 217 |
| 218 return ret; |
| 219 } |
| 220 |
| 196 bool InstallUtil::IsOSSupported() { | 221 bool InstallUtil::IsOSSupported() { |
| 197 // We do not support Win2K or older, or XP without service pack 2. | 222 // We do not support Win2K or older, or XP without service pack 2. |
| 198 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' | 223 VLOG(1) << base::SysInfo::OperatingSystemName() << ' ' |
| 199 << base::SysInfo::OperatingSystemVersion(); | 224 << base::SysInfo::OperatingSystemVersion(); |
| 200 base::win::Version version = base::win::GetVersion(); | 225 base::win::Version version = base::win::GetVersion(); |
| 201 return (version > base::win::VERSION_XP) || | 226 return (version > base::win::VERSION_XP) || |
| 202 ((version == base::win::VERSION_XP) && | 227 ((version == base::win::VERSION_XP) && |
| 203 (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); | 228 (base::win::OSInfo::GetInstance()->service_pack().major >= 2)); |
| 204 } | 229 } |
| 205 | 230 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, | 462 int len = GetDateFormatW(LOCALE_INVARIANT, 0, NULL, kDateFormat, |
| 438 date_str, arraysize(date_str)); | 463 date_str, arraysize(date_str)); |
| 439 if (len) { | 464 if (len) { |
| 440 --len; // Subtract terminating \0. | 465 --len; // Subtract terminating \0. |
| 441 } else { | 466 } else { |
| 442 PLOG(DFATAL) << "GetDateFormat"; | 467 PLOG(DFATAL) << "GetDateFormat"; |
| 443 } | 468 } |
| 444 | 469 |
| 445 return std::wstring(date_str, len); | 470 return std::wstring(date_str, len); |
| 446 } | 471 } |
| OLD | NEW |