summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--app/win/shell.cc4
-rw-r--r--base/win/win_util.cc11
-rw-r--r--base/win/win_util.h18
-rw-r--r--base/win/windows_version.h6
-rw-r--r--chrome/browser/memory_details_win.cc11
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc8
6 files changed, 41 insertions, 17 deletions
diff --git a/app/win/shell.cc b/app/win/shell.cc
index 0f64f06..a951315 100644
--- a/app/win/shell.cc
+++ b/app/win/shell.cc
@@ -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.
@@ -11,8 +11,8 @@
#include "base/native_library.h"
#include "base/string_util.h"
#include "base/win/scoped_comptr.h"
-#include "base/win/windows_version.h"
#include "base/win/win_util.h"
+#include "base/win/windows_version.h"
namespace app {
namespace win {
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,
diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc
index edb53c8..f6548fe 100644
--- a/chrome/browser/memory_details_win.cc
+++ b/chrome/browser/memory_details_win.cc
@@ -11,6 +11,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
+#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
@@ -72,10 +73,8 @@ void MemoryDetails::CollectProcessData(
for (unsigned int index = 0; index < process_data_.size(); index++)
process_data_[index].processes.clear();
- SYSTEM_INFO system_info;
- GetNativeSystemInfo(&system_info);
- bool is_64bit_os =
- system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
+ base::win::WindowsArchitecture windows_architecture =
+ base::win::GetWindowsArchitecture();
base::win::ScopedHandle snapshot(
::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
@@ -94,7 +93,9 @@ void MemoryDetails::CollectProcessData(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
if (!process_handle.Get())
continue;
- bool is_64bit_process = is_64bit_os &&
+ bool is_64bit_process =
+ ((windows_architecture == base::win::X64_ARCHITECTURE) ||
+ (windows_architecture == base::win::IA64_ARCHITECTURE)) &&
(base::win::GetWOW64StatusForProcess(process_handle) ==
base::win::WOW64_DISABLED);
for (unsigned int index2 = 0; index2 < process_data_.size(); index2++) {
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 8813a27..288b221 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -534,11 +534,9 @@ void AboutChromeView::ViewHierarchyChanged(bool is_add,
// for Vista is another option.
int service_pack_major = 0, service_pack_minor = 0;
base::win::GetServicePackLevel(&service_pack_major, &service_pack_minor);
- if (base::win::UserAccountControlIsEnabled() ||
- base::win::GetVersion() == base::win::VERSION_XP ||
- (base::win::GetVersion() == base::win::VERSION_VISTA &&
- service_pack_major >= 1) ||
- base::win::GetVersion() > base::win::VERSION_VISTA) {
+ if (!(base::win::GetVersion() == base::win::VERSION_VISTA &&
+ (service_pack_major == 0) &&
+ !base::win::UserAccountControlIsEnabled())) {
UpdateStatus(UPGRADE_CHECK_STARTED, GOOGLE_UPDATE_NO_ERROR);
// CheckForUpdate(false, ...) means don't upgrade yet.
google_updater_->CheckForUpdate(false, window());