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 <shellapi.h> | 10 #include <shellapi.h> |
10 #include <shlobj.h> | 11 #include <shlobj.h> |
11 #include <shobjidl.h> // Must be before propkey. | 12 #include <shobjidl.h> // Must be before propkey. |
12 #include <initguid.h> | 13 #include <initguid.h> |
13 #include <propkey.h> | 14 #include <propkey.h> |
14 #include <propvarutil.h> | 15 #include <propvarutil.h> |
15 #include <sddl.h> | 16 #include <sddl.h> |
16 #include <signal.h> | 17 #include <signal.h> |
17 #include <stdlib.h> | 18 #include <stdlib.h> |
18 | 19 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 226 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
226 return false; | 227 return false; |
227 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; | 228 const int kMultiTouch = NID_INTEGRATED_TOUCH | NID_MULTI_INPUT | NID_READY; |
228 int sm = GetSystemMetrics(SM_DIGITIZER); | 229 int sm = GetSystemMetrics(SM_DIGITIZER); |
229 if ((sm & kMultiTouch) == kMultiTouch) { | 230 if ((sm & kMultiTouch) == kMultiTouch) { |
230 return true; | 231 return true; |
231 } | 232 } |
232 return false; | 233 return false; |
233 } | 234 } |
234 | 235 |
236 bool IsTabletDevice() { | |
237 if (GetSystemMetrics(SM_MAXIMUMTOUCHES) == 0) | |
238 return false; | |
239 | |
240 base::win::Version version = base::win::GetVersion(); | |
241 if (version == base::win::VERSION_XP) | |
242 return (GetSystemMetrics(SM_TABLETPC) != 0); | |
243 | |
244 // If the device is docked, the user is treating the device as a PC. | |
245 if (GetSystemMetrics(SM_SYSTEMDOCKED) != 0) | |
246 return false; | |
247 | |
248 // PlatformRoleSlate was only added in Windows 8, but prior to Win8 it is | |
249 // still possible to check for a mobile power profile. | |
250 bool has_tablet_power_profile = false; | |
cpu_(ooo_6.6-7.5)
2014/05/06 19:48:45
seems we can init has_table_power_profile in line
| |
251 POWER_PLATFORM_ROLE role = PowerDeterminePlatformRole(); | |
252 has_tablet_power_profile = (role == PlatformRoleMobile); | |
253 if (version >= base::win::VERSION_WIN8) | |
254 has_tablet_power_profile |= (role == PlatformRoleSlate); | |
cpu_(ooo_6.6-7.5)
2014/05/06 19:48:45
the bitwise or scares me. Can you change to good o
| |
255 | |
256 if (has_tablet_power_profile) { | |
257 bool slate_mode = (GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0); | |
258 return slate_mode; | |
259 } | |
260 | |
261 return false; | |
262 } | |
263 | |
235 bool DisplayVirtualKeyboard() { | 264 bool DisplayVirtualKeyboard() { |
236 if (base::win::GetVersion() < base::win::VERSION_WIN8) | 265 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
237 return false; | 266 return false; |
238 | 267 |
239 static base::LazyInstance<string16>::Leaky osk_path = | 268 static base::LazyInstance<string16>::Leaky osk_path = |
240 LAZY_INSTANCE_INITIALIZER; | 269 LAZY_INSTANCE_INITIALIZER; |
241 | 270 |
242 if (osk_path.Get().empty()) { | 271 if (osk_path.Get().empty()) { |
243 // We need to launch TabTip.exe from the location specified under the | 272 // We need to launch TabTip.exe from the location specified under the |
244 // LocalServer32 key for the {{054AAE20-4BEA-4347-8A35-64A533254A9D}} | 273 // LocalServer32 key for the {{054AAE20-4BEA-4347-8A35-64A533254A9D}} |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 #if defined(_MSC_FULL_VER) | 404 #if defined(_MSC_FULL_VER) |
376 #pragma message(__PPOUT__(_MSC_FULL_VER)) | 405 #pragma message(__PPOUT__(_MSC_FULL_VER)) |
377 #endif | 406 #endif |
378 | 407 |
379 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") | 408 #pragma message("Visual Studio 2012 x86 must be updated to at least Update 1") |
380 #error Must install Update 1 to Visual Studio 2012. | 409 #error Must install Update 1 to Visual Studio 2012. |
381 #endif | 410 #endif |
382 | 411 |
383 #endif // _MSC_VER | 412 #endif // _MSC_VER |
384 | 413 |
OLD | NEW |