| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/events/event_rewriter.h" | 5 #include "chrome/browser/chromeos/events/event_rewriter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "ash/sticky_keys/sticky_keys_controller.h" | 11 #include "ash/sticky_keys/sticky_keys_controller.h" |
| 12 #include "ash/wm/common/window_state.h" | 12 #include "ash/wm/common/window_state.h" |
| 13 #include "ash/wm/window_state_aura.h" | 13 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
| 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" | 21 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 22 #include "chrome/browser/extensions/extension_commands_global_registry.h" | 22 #include "chrome/browser/extensions/extension_commands_global_registry.h" |
| 23 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 25 #include "chromeos/chromeos_switches.h" | 25 #include "chromeos/chromeos_switches.h" |
| 26 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 27 #include "components/user_manager/user_manager.h" | 27 #include "components/user_manager/user_manager.h" |
| 28 #include "ui/base/ime/chromeos/ime_keyboard.h" | 28 #include "ui/base/ime/chromeos/ime_keyboard.h" |
| 29 #include "ui/base/ime/chromeos/input_method_manager.h" | 29 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 30 #include "ui/events/devices/device_data_manager.h" | 30 #include "ui/events/devices/input_device_manager.h" |
| 31 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
| 32 #include "ui/events/event_utils.h" | 32 #include "ui/events/event_utils.h" |
| 33 #include "ui/events/keycodes/dom/dom_code.h" | 33 #include "ui/events/keycodes/dom/dom_code.h" |
| 34 #include "ui/events/keycodes/dom/dom_key.h" | 34 #include "ui/events/keycodes/dom/dom_key.h" |
| 35 #include "ui/events/keycodes/dom/keycode_converter.h" | 35 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 36 #include "ui/events/keycodes/keyboard_code_conversion.h" | 36 #include "ui/events/keycodes/keyboard_code_conversion.h" |
| 37 #include "ui/wm/core/window_util.h" | 37 #include "ui/wm/core/window_util.h" |
| 38 | 38 |
| 39 #if defined(USE_X11) | 39 #if defined(USE_X11) |
| 40 #include <X11/extensions/XInput2.h> | 40 #include <X11/extensions/XInput2.h> |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 VLOG(1) << "Unknown keyboard '" << device_name << "' connected: " | 1133 VLOG(1) << "Unknown keyboard '" << device_name << "' connected: " |
| 1134 << "id=" << device_id; | 1134 << "id=" << device_id; |
| 1135 } | 1135 } |
| 1136 // Always overwrite the existing device_id since the X server may reuse a | 1136 // Always overwrite the existing device_id since the X server may reuse a |
| 1137 // device id for an unattached device. | 1137 // device id for an unattached device. |
| 1138 device_id_to_type_[device_id] = type; | 1138 device_id_to_type_[device_id] = type; |
| 1139 return type; | 1139 return type; |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 EventRewriter::DeviceType EventRewriter::KeyboardDeviceAdded(int device_id) { | 1142 EventRewriter::DeviceType EventRewriter::KeyboardDeviceAdded(int device_id) { |
| 1143 if (!ui::DeviceDataManager::HasInstance()) | 1143 if (!ui::InputDeviceManager::HasInstance()) |
| 1144 return kDeviceUnknown; | 1144 return kDeviceUnknown; |
| 1145 const std::vector<ui::InputDevice>& keyboard_devices = | 1145 const std::vector<ui::InputDevice>& keyboard_devices = |
| 1146 ui::DeviceDataManager::GetInstance()->keyboard_devices(); | 1146 ui::InputDeviceManager::GetInstance()->keyboard_devices(); |
| 1147 for (const auto& keyboard : keyboard_devices) { | 1147 for (const auto& keyboard : keyboard_devices) { |
| 1148 if (keyboard.id == device_id) { | 1148 if (keyboard.id == device_id) { |
| 1149 return KeyboardDeviceAddedInternal( | 1149 return KeyboardDeviceAddedInternal( |
| 1150 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 1150 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
| 1151 } | 1151 } |
| 1152 } | 1152 } |
| 1153 return kDeviceUnknown; | 1153 return kDeviceUnknown; |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 } // namespace chromeos | 1156 } // namespace chromeos |
| OLD | NEW |