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 
5 #include "ui/chromeos/events/keyboard_layout_util.h"
6 
7 #include "ui/chromeos/events/event_rewriter_chromeos.h"
8 #include "ui/events/devices/device_data_manager.h"
9 
10 namespace ui {
11 
DeviceUsesKeyboardLayout2()12 bool DeviceUsesKeyboardLayout2() {
13   for (const InputDevice& keyboard :
14        DeviceDataManager::GetInstance()->GetKeyboardDevices()) {
15     if (EventRewriterChromeOS::GetKeyboardTopRowLayout(keyboard) ==
16         EventRewriterChromeOS::kKbdTopRowLayout2) {
17       return true;
18     }
19   }
20 
21   return false;
22 }
23 
DeviceKeyboardHasAssistantKey()24 bool DeviceKeyboardHasAssistantKey() {
25   for (const InputDevice& keyboard :
26        DeviceDataManager::GetInstance()->GetKeyboardDevices()) {
27     bool has_assistant_key = false;
28     if (EventRewriterChromeOS::HasAssistantKeyOnKeyboard(keyboard,
29                                                          &has_assistant_key) &&
30         has_assistant_key) {
31       return true;
32     }
33   }
34 
35   return false;
36 }
37 
38 }  // namespace ui
39