summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-08 21:29:05 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-08 21:29:05 +0000
commitf460cc8c601dc33138e32a94a2285ab9c587a7a0 (patch)
treee968ce24a150bd32f405f90166227bab753d7abd /chrome/installer
parent7045a47af50dce28324cf4a19eda30d91ef94695 (diff)
downloadchromium_src-f460cc8c601dc33138e32a94a2285ab9c587a7a0.zip
chromium_src-f460cc8c601dc33138e32a94a2285ab9c587a7a0.tar.gz
chromium_src-f460cc8c601dc33138e32a94a2285ab9c587a7a0.tar.bz2
Reuse a method that will be required for criteria checker as well.
Review URL: http://codereview.chromium.org/6587 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-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
3 files changed, 20 insertions, 27 deletions
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);
};