OLD | NEW |
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 <lm.h> | 8 #include <lm.h> |
9 #include <powrprof.h> | 9 #include <powrprof.h> |
10 #include <shellapi.h> | 10 #include <shellapi.h> |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // has the sideffect of clearing our exception filter, which means we | 215 // has the sideffect of clearing our exception filter, which means we |
216 // don't get any crash. | 216 // don't get any crash. |
217 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); | 217 _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); |
218 | 218 |
219 // Set a SIGABRT handler for good measure. We will crash even if the default | 219 // Set a SIGABRT handler for good measure. We will crash even if the default |
220 // is left in place, however this allows us to crash earlier. And it also | 220 // is left in place, however this allows us to crash earlier. And it also |
221 // lets us crash in response to code which might directly call raise(SIGABRT) | 221 // lets us crash in response to code which might directly call raise(SIGABRT) |
222 signal(SIGABRT, ForceCrashOnSigAbort); | 222 signal(SIGABRT, ForceCrashOnSigAbort); |
223 } | 223 } |
224 | 224 |
225 bool IsTouchEnabledDevice() { | |
226 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
227 return false; | |
228 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; | |
229 int sm = GetSystemMetrics(SM_DIGITIZER); | |
230 if ((sm & kMultiTouch) == kMultiTouch) { | |
231 return true; | |
232 } | |
233 return false; | |
234 } | |
235 | |
236 bool IsTabletDevice() { | 225 bool IsTabletDevice() { |
237 if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) | 226 if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) |
238 return false; | 227 return false; |
239 | 228 |
240 base::win::Version version = base::win::GetVersion(); | 229 base::win::Version version = base::win::GetVersion(); |
241 if (version == base::win::VERSION_XP) | 230 if (version == base::win::VERSION_XP) |
242 return (GetSystemMetrics(SM_TABLETPC) != 0); | 231 return (GetSystemMetrics(SM_TABLETPC) != 0); |
243 | 232 |
244 // If the device is docked, the user is treating the device as a PC. | 233 // If the device is docked, the user is treating the device as a PC. |
245 if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0) | 234 if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0) |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 #if defined(_MSC_FULL_VER) | 391 #if defined(_MSC_FULL_VER) |
403 #pragma message(__PPOUT__(_MSC_FULL_VER)) | 392 #pragma message(__PPOUT__(_MSC_FULL_VER)) |
404 #endif | 393 #endif |
405 | 394 |
406 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") | 395 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") |
407 #error Must install Update 1 to Visual Studio 2012. | 396 #error Must install Update 1 to Visual Studio 2012. |
408 #endif | 397 #endif |
409 | 398 |
410 #endif // _MSC_VER | 399 #endif // _MSC_VER |
411 | 400 |
OLD | NEW |