| 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 <cfgmgr32.h> | 8 #include <cfgmgr32.h> |
| 9 #include <lm.h> | 9 #include <lm.h> |
| 10 #include <powrprof.h> | 10 #include <powrprof.h> |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 return false; | 497 return false; |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 // PlatformRoleSlate was added in Windows 8+. | 501 // PlatformRoleSlate was added in Windows 8+. |
| 502 POWER_PLATFORM_ROLE role = GetPlatformRole(); | 502 POWER_PLATFORM_ROLE role = GetPlatformRole(); |
| 503 bool mobile_power_profile = (role == PlatformRoleMobile); | 503 bool mobile_power_profile = (role == PlatformRoleMobile); |
| 504 bool slate_power_profile = (role == PlatformRoleSlate); | 504 bool slate_power_profile = (role == PlatformRoleSlate); |
| 505 | 505 |
| 506 bool is_tablet = false; | 506 bool is_tablet = false; |
| 507 bool is_tablet_pc = false; | |
| 508 if (mobile_power_profile || slate_power_profile) { | 507 if (mobile_power_profile || slate_power_profile) { |
| 509 is_tablet_pc = !GetSystemMetrics(SM_TABLETPC); | |
| 510 is_tablet = !GetSystemMetrics(SM_CONVERTIBLESLATEMODE); | 508 is_tablet = !GetSystemMetrics(SM_CONVERTIBLESLATEMODE); |
| 511 if (!is_tablet) { | 509 if (!is_tablet) { |
| 512 if (reason) { | 510 if (reason) { |
| 513 *reason += "Not in slate mode.\n"; | 511 *reason += "Not in slate mode.\n"; |
| 514 } else { | 512 } else { |
| 515 return false; | 513 return false; |
| 516 } | 514 } |
| 517 } else { | 515 } else { |
| 518 if (reason) { | 516 if (reason) { |
| 519 *reason += (role == PlatformRoleMobile) ? "PlatformRoleMobile\n" : | 517 *reason += (role == PlatformRoleMobile) ? "PlatformRoleMobile\n" : |
| 520 "PlatformRoleSlate\n"; | 518 "PlatformRoleSlate\n"; |
| 521 } | 519 } |
| 522 } | 520 } |
| 523 } else { | 521 } else { |
| 524 if (reason) | 522 if (reason) |
| 525 *reason += "Device role is not mobile or slate.\n"; | 523 *reason += "Device role is not mobile or slate.\n"; |
| 526 } | 524 } |
| 527 return is_tablet && is_tablet_pc; | 525 return is_tablet; |
| 528 } | 526 } |
| 529 | 527 |
| 530 bool DisplayVirtualKeyboard() { | 528 bool DisplayVirtualKeyboard() { |
| 531 if (GetVersion() < VERSION_WIN8) | 529 if (GetVersion() < VERSION_WIN8) |
| 532 return false; | 530 return false; |
| 533 | 531 |
| 534 if (IsKeyboardPresentOnSlate(nullptr)) | 532 if (IsKeyboardPresentOnSlate(nullptr)) |
| 535 return false; | 533 return false; |
| 536 | 534 |
| 537 static LazyInstance<string16>::Leaky osk_path = LAZY_INSTANCE_INITIALIZER; | 535 static LazyInstance<string16>::Leaky osk_path = LAZY_INSTANCE_INITIALIZER; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 } | 700 } |
| 703 | 701 |
| 704 void DisableFlicks(HWND hwnd) { | 702 void DisableFlicks(HWND hwnd) { |
| 705 ::SetProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, | 703 ::SetProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, |
| 706 reinterpret_cast<HANDLE>(TABLET_DISABLE_FLICKS | | 704 reinterpret_cast<HANDLE>(TABLET_DISABLE_FLICKS | |
| 707 TABLET_DISABLE_FLICKFALLBACKKEYS)); | 705 TABLET_DISABLE_FLICKFALLBACKKEYS)); |
| 708 } | 706 } |
| 709 | 707 |
| 710 } // namespace win | 708 } // namespace win |
| 711 } // namespace base | 709 } // namespace base |
| OLD | NEW |