| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/device_keyboard_handler.h" |
| 6 | 6 |
| 7 #include "ash/new_window_delegate.h" | 7 #include "ash/new_window_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
| 14 #include "content/public/browser/web_ui.h" | 14 #include "content/public/browser/web_ui.h" |
| 15 #include "ui/events/devices/device_data_manager.h" | 15 #include "ui/events/devices/device_data_manager.h" |
| 16 #include "ui/events/devices/keyboard_device.h" | |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 bool HasExternalKeyboard() { | 19 bool HasExternalKeyboard() { |
| 21 for (const ui::KeyboardDevice& keyboard : | 20 for (const ui::InputDevice& keyboard : |
| 22 ui::DeviceDataManager::GetInstance()->keyboard_devices()) { | 21 ui::DeviceDataManager::GetInstance()->keyboard_devices()) { |
| 23 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) | 22 if (keyboard.type == ui::InputDeviceType::INPUT_DEVICE_EXTERNAL) |
| 24 return true; | 23 return true; |
| 25 } | 24 } |
| 26 | 25 |
| 27 return false; | 26 return false; |
| 28 } | 27 } |
| 29 | 28 |
| 30 } // namespace | 29 } // namespace |
| 31 | 30 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const base::FundamentalValue has_diamond_key( | 75 const base::FundamentalValue has_diamond_key( |
| 77 base::CommandLine::ForCurrentProcess()->HasSwitch( | 76 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 78 chromeos::switches::kHasChromeOSDiamondKey)); | 77 chromeos::switches::kHasChromeOSDiamondKey)); |
| 79 CallJavascriptFunction("cr.webUIListenerCallback", | 78 CallJavascriptFunction("cr.webUIListenerCallback", |
| 80 base::StringValue("show-keys-changed"), has_caps_lock, | 79 base::StringValue("show-keys-changed"), has_caps_lock, |
| 81 has_diamond_key); | 80 has_diamond_key); |
| 82 } | 81 } |
| 83 | 82 |
| 84 } // namespace settings | 83 } // namespace settings |
| 85 } // namespace chromeos | 84 } // namespace chromeos |
| OLD | NEW |