Chromium Code Reviews| 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 |
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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::DeviceDataManager::HasInstance()) |
| 1144 return kDeviceUnknown; | 1144 return kDeviceUnknown; |
| 1145 const std::vector<ui::KeyboardDevice>& keyboards = | 1145 const std::vector<ui::InputDevice>& keyboards = |
|
sky
2016/05/31 18:13:45
keyboard_devices? or perhaps just move into for lo
kylechar
2016/05/31 19:31:12
Done.
| |
| 1146 ui::DeviceDataManager::GetInstance()->keyboard_devices(); | 1146 ui::DeviceDataManager::GetInstance()->keyboard_devices(); |
| 1147 for (const auto& keyboard : keyboards) { | 1147 for (const auto& keyboard : keyboards) { |
| 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 |