summaryrefslogtreecommitdiffstats
path: root/chromium/base/win/win_util.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-08-14 11:38:45 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-08-14 17:16:47 +0000
commit3a97ca8dd9b96b599ae2d33e40df0dd2f7ea5859 (patch)
tree43cc572ba067417c7341db81f71ae7cc6e0fcc3e /chromium/base/win/win_util.cc
parentf61ab1ac7f855cd281809255c0aedbb1895e1823 (diff)
BASELINE: Update chromium to 45.0.2454.40
Change-Id: Id2121d9f11a8fc633677236c65a3e41feef589e4 Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/base/win/win_util.cc')
-rw-r--r--chromium/base/win/win_util.cc57
1 files changed, 27 insertions, 30 deletions
diff --git a/chromium/base/win/win_util.cc b/chromium/base/win/win_util.cc
index 6f8cdaf5fda..96d646ad31f 100644
--- a/chromium/base/win/win_util.cc
+++ b/chromium/base/win/win_util.cc
@@ -44,7 +44,7 @@ namespace {
bool SetPropVariantValueForPropertyStore(
IPropertyStore* property_store,
const PROPERTYKEY& property_key,
- const base::win::ScopedPropVariant& property_value) {
+ const ScopedPropVariant& property_value) {
DCHECK(property_store);
HRESULT result = property_store->SetValue(property_key, property_value.get());
@@ -54,7 +54,7 @@ bool SetPropVariantValueForPropertyStore(
}
void __cdecl ForceCrashOnSigAbort(int) {
- *((int*)0) = 0x1337;
+ *((volatile int*)0) = 0x1337;
}
const wchar_t kWindows8OSKRegPath[] =
@@ -72,8 +72,7 @@ bool IsKeyboardPresentOnSlate(std::string* reason) {
bool result = false;
if (GetVersion() < VERSION_WIN7) {
- if (reason)
- *reason = "Detection not supported";
+ *reason = "Detection not supported";
return false;
}
@@ -193,8 +192,8 @@ bool IsKeyboardPresentOnSlate(std::string* reason) {
if (status == CR_SUCCESS) {
// To reduce the scope of the hack we only look for ACPI and HID\\VID
// prefixes in the keyboard device ids.
- if (StartsWith(device_id, L"ACPI", false) ||
- StartsWith(device_id, L"HID\\VID", false)) {
+ if (StartsWith(device_id, L"ACPI", CompareCase::INSENSITIVE_ASCII) ||
+ StartsWith(device_id, L"HID\\VID", CompareCase::INSENSITIVE_ASCII)) {
if (reason) {
*reason += "device: ";
*reason += WideToUTF8(device_id);
@@ -229,7 +228,7 @@ bool GetUserSidString(std::wstring* user_sid) {
HANDLE token = NULL;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
return false;
- base::win::ScopedHandle token_scoped(token);
+ ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
scoped_ptr<BYTE[]> user_bytes(new BYTE[size]);
@@ -274,11 +273,11 @@ bool UserAccountControlIsEnabled() {
// This can be slow if Windows ends up going to disk. Should watch this key
// for changes and only read it once, preferably on the file thread.
// http://code.google.com/p/chromium/issues/detail?id=61644
- base::ThreadRestrictions::ScopedAllowIO allow_io;
+ ThreadRestrictions::ScopedAllowIO allow_io;
- base::win::RegKey key(HKEY_LOCAL_MACHINE,
- L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
- KEY_READ);
+ RegKey key(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System",
+ KEY_READ);
DWORD uac_enabled;
if (key.ReadValueDW(L"EnableLUA", &uac_enabled) != ERROR_SUCCESS)
return true;
@@ -332,20 +331,20 @@ static const char16 kAutoRunKeyPath[] =
bool AddCommandToAutoRun(HKEY root_key, const string16& name,
const string16& command) {
- base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE);
+ RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE);
return (autorun_key.WriteValue(name.c_str(), command.c_str()) ==
ERROR_SUCCESS);
}
bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name) {
- base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE);
+ RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE);
return (autorun_key.DeleteValue(name.c_str()) == ERROR_SUCCESS);
}
bool ReadCommandFromAutoRun(HKEY root_key,
const string16& name,
string16* command) {
- base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_QUERY_VALUE);
+ RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_QUERY_VALUE);
return (autorun_key.ReadValue(name.c_str(), command) == ERROR_SUCCESS);
}
@@ -374,8 +373,8 @@ bool IsTabletDevice() {
if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0)
return false;
- base::win::Version version = base::win::GetVersion();
- if (version == base::win::VERSION_XP)
+ Version version = GetVersion();
+ if (version == VERSION_XP)
return (GetSystemMetrics(SM_TABLETPC) != 0);
// If the device is docked, the user is treating the device as a PC.
@@ -387,7 +386,7 @@ bool IsTabletDevice() {
POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole();
bool mobile_power_profile = (role == PlatformRoleMobile);
bool slate_power_profile = false;
- if (version >= base::win::VERSION_WIN8)
+ if (version >= VERSION_WIN8)
slate_power_profile = (role == PlatformRoleSlate);
if (mobile_power_profile || slate_power_profile)
@@ -397,14 +396,13 @@ bool IsTabletDevice() {
}
bool DisplayVirtualKeyboard() {
- if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ if (GetVersion() < VERSION_WIN8)
return false;
if (IsKeyboardPresentOnSlate(nullptr))
return false;
- static base::LazyInstance<string16>::Leaky osk_path =
- LAZY_INSTANCE_INITIALIZER;
+ static LazyInstance<string16>::Leaky osk_path = LAZY_INSTANCE_INITIALIZER;
if (osk_path.Get().empty()) {
// We need to launch TabTip.exe from the location specified under the
@@ -415,9 +413,8 @@ bool DisplayVirtualKeyboard() {
// We don't want to launch TabTip.exe from
// c:\program files (x86)\common files\microsoft shared\ink. This path is
// normally found on 64 bit Windows.
- base::win::RegKey key(HKEY_LOCAL_MACHINE,
- kWindows8OSKRegPath,
- KEY_READ | KEY_WOW64_64KEY);
+ RegKey key(HKEY_LOCAL_MACHINE, kWindows8OSKRegPath,
+ KEY_READ | KEY_WOW64_64KEY);
DWORD osk_path_length = 1024;
if (key.ReadValue(NULL,
WriteInto(&osk_path.Get(), osk_path_length),
@@ -458,7 +455,7 @@ bool DisplayVirtualKeyboard() {
common_program_files_path = common_program_files_wow6432.get();
DCHECK(!common_program_files_path.empty());
} else {
- base::win::ScopedCoMem<wchar_t> common_program_files;
+ ScopedCoMem<wchar_t> common_program_files;
if (FAILED(SHGetKnownFolderPath(FOLDERID_ProgramFilesCommon, 0, NULL,
&common_program_files))) {
return false;
@@ -480,7 +477,7 @@ bool DisplayVirtualKeyboard() {
}
bool DismissVirtualKeyboard() {
- if (base::win::GetVersion() < base::win::VERSION_WIN8)
+ if (GetVersion() < VERSION_WIN8)
return false;
// We dismiss the virtual keyboard by generating the ESC keystroke
@@ -522,21 +519,21 @@ void SetDomainStateForTesting(bool state) {
}
bool MaybeHasSHA256Support() {
- const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance();
+ const OSInfo* os_info = OSInfo::GetInstance();
- if (os_info->version() == base::win::VERSION_PRE_XP)
+ if (os_info->version() == VERSION_PRE_XP)
return false; // Too old to have it and this OS is not supported anyway.
- if (os_info->version() == base::win::VERSION_XP)
+ if (os_info->version() == VERSION_XP)
return os_info->service_pack().major >= 3; // Windows XP SP3 has it.
// Assume it is missing in this case, although it may not be. This category
// includes Windows XP x64, and Windows Server, where a hotfix could be
// deployed.
- if (os_info->version() == base::win::VERSION_SERVER_2003)
+ if (os_info->version() == VERSION_SERVER_2003)
return false;
- DCHECK(os_info->version() >= base::win::VERSION_VISTA);
+ DCHECK(os_info->version() >= VERSION_VISTA);
return true; // New enough to have SHA-256 support.
}