keyboard_layout_util.cc 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/chromeos/events/keyboard_layout_util.h"
  5. #include "ui/chromeos/events/event_rewriter_chromeos.h"
  6. #include "ui/events/devices/device_data_manager.h"
  7. namespace ui {
  8. bool DeviceUsesKeyboardLayout2() {
  9. for (const InputDevice& keyboard :
  10. DeviceDataManager::GetInstance()->GetKeyboardDevices()) {
  11. if (EventRewriterChromeOS::GetKeyboardTopRowLayout(keyboard) ==
  12. EventRewriterChromeOS::kKbdTopRowLayout2) {
  13. return true;
  14. }
  15. }
  16. return false;
  17. }
  18. bool DeviceKeyboardHasAssistantKey() {
  19. for (const InputDevice& keyboard :
  20. DeviceDataManager::GetInstance()->GetKeyboardDevices()) {
  21. bool has_assistant_key = false;
  22. if (EventRewriterChromeOS::HasAssistantKeyOnKeyboard(keyboard,
  23. &has_assistant_key) &&
  24. has_assistant_key) {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. } // namespace ui