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

Side by Side Diff: base/win/win_util.cc

Issue 10909206: Add tablet heuristic detection (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win/win_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/win/win_util.h" 5 #include "base/win/win_util.h"
6 6
7 #include <aclapi.h> 7 #include <aclapi.h>
8 #include <shobjidl.h> // Must be before propkey. 8 #include <shobjidl.h> // Must be before propkey.
9 #include <initguid.h> 9 #include <initguid.h>
10 #include <propkey.h> 10 #include <propkey.h>
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 } 207 }
208 208
209 void SetShouldCrashOnProcessDetach(bool crash) { 209 void SetShouldCrashOnProcessDetach(bool crash) {
210 g_crash_on_process_detach = crash; 210 g_crash_on_process_detach = crash;
211 } 211 }
212 212
213 bool ShouldCrashOnProcessDetach() { 213 bool ShouldCrashOnProcessDetach() {
214 return g_crash_on_process_detach; 214 return g_crash_on_process_detach;
215 } 215 }
216 216
217 bool IsMachineATablet() {
218 if (base::win::GetVersion() < base::win::VERSION_WIN7)
219 return false;
220 // TODO(ananta): Add keyboard detection logic if it can be made reliable.
221 const int kPenInput = NID_INTEGRATED_PEN | NID_EXTERNAL_PEN;
222 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY;
223 int sm = GetSystemMetrics(SM_DIGITIZER);
224 return ((sm & kMultiTouch) == kMultiTouch) && ((sm & kPenInput) == 0);
225 }
226
217 } // namespace win 227 } // namespace win
218 } // namespace base 228 } // namespace base
219 229
220 #ifdef _MSC_VER 230 #ifdef _MSC_VER
221 // 231 //
222 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. 232 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1.
223 // 233 //
224 extern char VisualStudio2005ServicePack1Detection[10]; 234 extern char VisualStudio2005ServicePack1Detection[10];
225 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), 235 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*),
226 VS2005SP1Detect); 236 VS2005SP1Detect);
227 // 237 //
228 // Chrome requires at least Service Pack 1 for Visual Studio 2005. 238 // Chrome requires at least Service Pack 1 for Visual Studio 2005.
229 // 239 //
230 #endif // _MSC_VER 240 #endif // _MSC_VER
231 241
232 #ifndef COPY_FILE_COPY_SYMLINK 242 #ifndef COPY_FILE_COPY_SYMLINK
233 #error You must install the Windows 2008 or Vista Software Development Kit and \ 243 #error You must install the Windows 2008 or Vista Software Development Kit and \
234 set it as your default include path to build this library. You can grab it by \ 244 set it as your default include path to build this library. You can grab it by \
235 searching for "download windows sdk 2008" in your favorite web search engine. \ 245 searching for "download windows sdk 2008" in your favorite web search engine. \
236 Also make sure you register the SDK with Visual Studio, by selecting \ 246 Also make sure you register the SDK with Visual Studio, by selecting \
237 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ 247 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \
238 menu (see Start - All Programs - Microsoft Windows SDK - \ 248 menu (see Start - All Programs - Microsoft Windows SDK - \
239 Visual Studio Registration). 249 Visual Studio Registration).
240 #endif 250 #endif
OLDNEW
« no previous file with comments | « base/win/win_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698