summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc11
-rw-r--r--chrome/installer/setup/main.cc28
-rw-r--r--chrome/installer/util/install_util.cc16
-rw-r--r--chrome/installer/util/install_util.h3
4 files changed, 23 insertions, 35 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index cb79033..1d8dda4 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -175,18 +175,13 @@ int DoUninstallTasks() {
// functionality so we just ask the users if they want to uninstall Chrome.
int HandleIconsCommands(const CommandLine &parsed_command_line) {
if (parsed_command_line.HasSwitch(switches::kHideIcons)) {
- OSVERSIONINFO version = {0};
- version.dwOSVersionInfoSize = sizeof(version);
- if (!GetVersionEx(&version))
- return ResultCodes::UNSUPPORTED_PARAM;
-
std::wstring cp_applet;
- if (version.dwMajorVersion >= 6) {
+ if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) {
cp_applet.assign(L"Programs and Features"); // Windows Vista and later.
- } else if (version.dwMajorVersion == 5 && version.dwMinorVersion >= 1) {
+ } else if (win_util::GetWinVersion() == win_util::WINVERSION_XP) {
cp_applet.assign(L"Add/Remove Programs"); // Windows XP.
} else {
- return ResultCodes::UNSUPPORTED_PARAM; // Not supported on Win2K?
+ return ResultCodes::UNSUPPORTED_PARAM; // Not supported
}
const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED,
diff --git a/chrome/installer/setup/main.cc b/chrome/installer/setup/main.cc
index 9714f68..f9bf767 100644
--- a/chrome/installer/setup/main.cc
+++ b/chrome/installer/setup/main.cc
@@ -30,32 +30,6 @@
namespace {
-// Checks if the current system is running Windows XP or later. We are not
-// supporting Windows 2K for beta release.
-bool IsWindowsXPorLater() {
- OSVERSIONINFOEX osvi;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- GetVersionEx((OSVERSIONINFO *) &osvi);
-
- // Windows versioning scheme doesn't seem very clear but here is what
- // the code is checking as the minimum version required for Chrome:
- // * Major > 5 is Vista or later so no further checks for Service Pack
- // * Major = 5 && Minor > 1 is Windows Server 2003 so again no SP checks
- // * Major = 5 && Minor = 1 is WinXP so check for SP1 or later
- LOG(INFO) << "Windows Version: Major - " << osvi.dwMajorVersion
- << " Minor - " << osvi.dwMinorVersion
- << " Service Pack Major - " << osvi.wServicePackMajor
- << " Service Pack Minor - " << osvi.wServicePackMinor;
- if ((osvi.dwMajorVersion > 5) || // Vista or later
- ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion > 1)) || // Win 2003
- ((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion == 1) &&
- (osvi.wServicePackMajor >= 1))) { // WinXP with SP1
- return true;
- }
- return false;
-}
-
// Applies a binary patch to existing Chrome installer archive on the system.
// Uses bspatch library.
int PatchArchiveFile(bool system_install, const std::wstring& archive_path,
@@ -304,7 +278,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
// Check to make sure current system is WinXP or later. If not, log
// error message and get out.
- if (!IsWindowsXPorLater()) {
+ if (!InstallUtil::IsOSSupported()) {
LOG(ERROR) << "Chrome only supports Windows XP or later.";
return installer_util::OS_NOT_SUPPORTED;
}
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index ee5e7c4..290a60a 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/registry.h"
#include "base/string_util.h"
+#include "base/win_util.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -33,3 +34,18 @@ installer::Version* InstallUtil::GetChromeVersion(bool system_install) {
return installer::Version::GetVersionFromString(version_str);
}
+bool InstallUtil::IsOSSupported() {
+ int major, minor;
+ win_util::WinVersion version = win_util::GetWinVersion();
+ win_util::GetServicePackLevel(&major, &minor);
+
+ // We do not support Win2K or older, or XP without service pack 1.
+ LOG(INFO) << "Windows Version: " << version
+ << ", Service Pack: " << major << "." << minor;
+ if ((version == win_util::WINVERSION_VISTA) ||
+ (version == win_util::WINVERSION_SERVER_2003) ||
+ (version == win_util::WINVERSION_XP && major >= 1)) {
+ return true;
+ }
+ return false;
+}
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 1bd5aaa..6e6d6da 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -26,6 +26,9 @@ class InstallUtil {
// system_install: if true, looks for version number under the HKLM root,
// otherwise looks under the HKCU.
static installer::Version * GetChromeVersion(bool system_install);
+
+ // This function checks if the current OS is supported for Chromium.
+ static bool IsOSSupported();
private:
DISALLOW_EVIL_CONSTRUCTORS(InstallUtil);
};