Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(861)

Unified Diff: base/win/win_util.cc

Issue 262773015: Add an UMA metric to track whether chrome is running on a tablet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review issues. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/win/win_util.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « base/win/win_util.h ('k') | chrome/browser/chrome_browser_main_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698