diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 22:49:30 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-27 22:49:30 +0000 |
commit | f86c6b403837cc3218aac50cc98061f7ff2cf056 (patch) | |
tree | 3ecd7bb2c796cf1a80a1243a97d3fe765d6b43d7 /base/win | |
parent | 3b91edbe092913447750a7e9fd9ee6e6365808a6 (diff) | |
download | chromium_src-f86c6b403837cc3218aac50cc98061f7ff2cf056.zip chromium_src-f86c6b403837cc3218aac50cc98061f7ff2cf056.tar.gz chromium_src-f86c6b403837cc3218aac50cc98061f7ff2cf056.tar.bz2 |
New tablet heuristic: integrated multi-touch available and screen not greater than 1366x768.
BUG=152198
TEST=Chrome should switch to metro after making it the default browser via first-run UI on a machine that satisfies the new heuristic.
Review URL: https://chromiumcodereview.appspot.com/10986066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r-- | base/win/win_util.cc | 11 | ||||
-rw-r--r-- | base/win/win_util.h | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/base/win/win_util.cc b/base/win/win_util.cc index 569de06..956c746 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -221,11 +221,16 @@ bool ShouldCrashOnProcessDetach() { bool IsMachineATablet() { if (base::win::GetVersion() < base::win::VERSION_WIN7) return false; - // TODO(ananta): Add keyboard detection logic if it can be made reliable. - const int kPenInput = NID_INTEGRATED_PEN | NID_EXTERNAL_PEN; const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; + const int kMaxTabletScreenWidth = 1366; + const int kMaxTabletScreenHeight = 768; int sm = GetSystemMetrics(SM_DIGITIZER); - return ((sm & kMultiTouch) == kMultiTouch) && ((sm & kPenInput) == 0); + if ((sm & kMultiTouch) == kMultiTouch) { + int cx = GetSystemMetrics(SM_CXSCREEN); + int cy = GetSystemMetrics(SM_CYSCREEN); + return cx <= kMaxTabletScreenWidth && cy <= kMaxTabletScreenHeight; + } + return false; } } // namespace win diff --git a/base/win/win_util.h b/base/win/win_util.h index 5a5a20a..032dd42 100644 --- a/base/win/win_util.h +++ b/base/win/win_util.h @@ -106,8 +106,7 @@ BASE_EXPORT void SetShouldCrashOnProcessDetach(bool crash); BASE_EXPORT bool ShouldCrashOnProcessDetach(); // A tablet by this definition is something that has integrated multi-touch -// but is not also pen-enabled. For example a Thinkpad X220 tablet is not -// considered a tabled while a Samsum 700T tablet is. +// ready to use and also has screen resolution not greater than 1366x768. BASE_EXPORT bool IsMachineATablet(); // Get the size of a struct up to and including the specified member. |