| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 pressed_modifier_latches_ &= ~characteristic_flag; | 812 pressed_modifier_latches_ &= ~characteristic_flag; |
| 813 } | 813 } |
| 814 | 814 |
| 815 if (key_event.type() == ui::ET_KEY_PRESSED) { | 815 if (key_event.type() == ui::ET_KEY_PRESSED) { |
| 816 if (!ui::KeycodeConverter::IsDomKeyForModifier(state->key)) { | 816 if (!ui::KeycodeConverter::IsDomKeyForModifier(state->key)) { |
| 817 used_modifier_latches_ |= pressed_modifier_latches_; | 817 used_modifier_latches_ |= pressed_modifier_latches_; |
| 818 latched_modifier_latches_ = ui::EF_NONE; | 818 latched_modifier_latches_ = ui::EF_NONE; |
| 819 } | 819 } |
| 820 // Toggle Caps Lock if the remapped key is ui::VKEY_CAPITAL. | 820 // Toggle Caps Lock if the remapped key is ui::VKEY_CAPITAL. |
| 821 if (state->key_code == ui::VKEY_CAPITAL | 821 if (state->key_code == ui::VKEY_CAPITAL |
| 822 // ... except on linux Chrome OS, where InputMethodChromeOS handles it. |
| 823 && (base::SysInfo::IsRunningOnChromeOS() || ime_keyboard_for_testing_) |
| 822 #if defined(USE_X11) | 824 #if defined(USE_X11) |
| 823 // ... but for X11, do nothing if the original key is ui::VKEY_CAPITAL | 825 // ... but for X11, do nothing if the original key is ui::VKEY_CAPITAL |
| 824 // (i.e. a Caps Lock key on an external keyboard is pressed) since X | 826 // (i.e. a Caps Lock key on an external keyboard is pressed) since X |
| 825 // handles that itself. | 827 // handles that itself. |
| 826 && incoming.key_code != ui::VKEY_CAPITAL | 828 && incoming.key_code != ui::VKEY_CAPITAL |
| 827 #endif | 829 #endif |
| 828 ) { | 830 ) { |
| 829 chromeos::input_method::ImeKeyboard* ime_keyboard = | 831 chromeos::input_method::ImeKeyboard* ime_keyboard = |
| 830 ime_keyboard_for_testing_ | 832 ime_keyboard_for_testing_ |
| 831 ? ime_keyboard_for_testing_ | 833 ? ime_keyboard_for_testing_ |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 for (const auto& keyboard : keyboard_devices) { | 1144 for (const auto& keyboard : keyboard_devices) { |
| 1143 if (keyboard.id == device_id) { | 1145 if (keyboard.id == device_id) { |
| 1144 return KeyboardDeviceAddedInternal( | 1146 return KeyboardDeviceAddedInternal( |
| 1145 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); | 1147 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); |
| 1146 } | 1148 } |
| 1147 } | 1149 } |
| 1148 return kDeviceUnknown; | 1150 return kDeviceUnknown; |
| 1149 } | 1151 } |
| 1150 | 1152 |
| 1151 } // namespace chromeos | 1153 } // namespace chromeos |
| OLD | NEW |