Index: base/win/win_util.cc |
diff --git a/base/win/win_util.cc b/base/win/win_util.cc |
index 601dd7cd28847e1facb06d26b66f4952335124d0..061b2a40683619d1757b9f1fd3c807b4f5f0d6db 100644 |
--- a/base/win/win_util.cc |
+++ b/base/win/win_util.cc |
@@ -6,6 +6,7 @@ |
#include <aclapi.h> |
#include <lm.h> |
+#include <powrprof.h> |
#include <shellapi.h> |
#include <shlobj.h> |
#include <shobjidl.h> // Must be before propkey. |
@@ -232,6 +233,32 @@ bool IsTouchEnabledDevice() { |
return false; |
} |
+bool IsTabletDevice() { |
+ if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) |
+ return false; |
+ |
+ base::win::Version version = base::win::GetVersion(); |
+ if (version == base::win::VERSION_XP) |
+ return (GetSystemMetrics(SM_TABLETPC) != 0); |
+ |
+ // If the device is docked, the user is treating the device as a PC. |
+ if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0) |
+ return false; |
+ |
+ // PlatformRoleSlate was only added in Windows 8, but prior to Win8 it is |
+ // still possible to check for a mobile power profile. |
+ POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole(); |
+ bool mobile_power_profile = (role == PlatformRoleMobile); |
+ bool slate_power_profile = false; |
+ if (version >= base::win::VERSION_WIN8) |
+ slate_power_profile = (role == PlatformRoleSlate); |
+ |
+ if (mobile_power_profile || slate_power_profile) |
+ return (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0); |
+ |
+ return false; |
+} |
+ |
bool DisplayVirtualKeyboard() { |
if (base::win::GetVersion() < base::win::VERSION_WIN8) |
return false; |