summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 19:12:29 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 19:12:29 +0000
commitaf67f2047292bcc2744d94edf93a00ac46d0a829 (patch)
tree1df2731d26a8a3c99f99ef062b507cf17a3b9d06 /base
parent74a2bbe73c9102fa5f14fecb34aaf98a6e1b1784 (diff)
downloadchromium_src-af67f2047292bcc2744d94edf93a00ac46d0a829.zip
chromium_src-af67f2047292bcc2744d94edf93a00ac46d0a829.tar.gz
chromium_src-af67f2047292bcc2744d94edf93a00ac46d0a829.tar.bz2
Add a function to get the processor architecture. I will be using this in the user agent construction code.
Also cleans up a few nearby things. BUG=none TEST=none Review URL: http://codereview.chromium.org/6632002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76945 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/win/win_util.cc11
-rw-r--r--base/win/win_util.h18
-rw-r--r--base/win/windows_version.h6
3 files changed, 30 insertions, 5 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc
index 76d8c5d..93c086a 100644
--- a/base/win/win_util.cc
+++ b/base/win/win_util.cc
@@ -100,6 +100,17 @@ bool UserAccountControlIsEnabled() {
return (uac_enabled != 0);
}
+WindowsArchitecture GetWindowsArchitecture() {
+ SYSTEM_INFO system_info;
+ GetNativeSystemInfo(&system_info);
+ switch (system_info.wProcessorArchitecture) {
+ case PROCESSOR_ARCHITECTURE_INTEL: return X86_ARCHITECTURE;
+ case PROCESSOR_ARCHITECTURE_AMD64: return X64_ARCHITECTURE;
+ case PROCESSOR_ARCHITECTURE_IA64: return IA64_ARCHITECTURE;
+ default: return OTHER_ARCHITECTURE;
+ }
+}
+
bool SetAppIdForPropertyStore(IPropertyStore* property_store,
const wchar_t* app_id) {
DCHECK(property_store);
diff --git a/base/win/win_util.h b/base/win/win_util.h
index f95e05c..3520622 100644
--- a/base/win/win_util.h
+++ b/base/win/win_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,9 +55,23 @@ bool IsAltPressed();
// NOTE: The EnableLUA registry flag, which is ignored on Windows XP
// machines, might still exist and be set to 0 (UAC disabled), in which case
// this function will return false. You should therefore check this flag only
-// if the OS is Vista.
+// if the OS is Vista or later.
bool UserAccountControlIsEnabled();
+enum WindowsArchitecture {
+ X86_ARCHITECTURE,
+ X64_ARCHITECTURE,
+ IA64_ARCHITECTURE,
+ OTHER_ARCHITECTURE,
+};
+
+// Returns the processor architecture this copy of Windows natively uses.
+// For example, given an x64-capable processor, we have three possibilities:
+// 32-bit Chrome running on 32-bit Windows: X86_ARCHITECTURE
+// 32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE
+// 64-bit Chrome running on 64-bit Windows: X64_ARCHITECTURE
+WindowsArchitecture GetWindowsArchitecture();
+
// Sets the application id in given IPropertyStore. The function is intended
// for tagging application/chromium shortcut, browser window and jump list for
// Win7.
diff --git a/base/win/windows_version.h b/base/win/windows_version.h
index 0cfb2c7..bdd783d 100644
--- a/base/win/windows_version.h
+++ b/base/win/windows_version.h
@@ -15,10 +15,10 @@ namespace win {
// "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values,
// though.
enum Version {
- VERSION_PRE_2000 = 0, // Not supported
- VERSION_2000 = 1, // Not supported
+ VERSION_PRE_2000 = 0, // Not supported
+ VERSION_2000 = 1, // Not supported
VERSION_XP = 2,
- VERSION_SERVER_2003 = 3,
+ VERSION_SERVER_2003 = 3, // Also includes Windows XP Professional x64 edition
VERSION_VISTA = 4,
VERSION_2008 = 5,
VERSION_WIN7 = 6,