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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ui::VKEY_CONTROL}}, | 88 ui::VKEY_CONTROL}}, |
89 {// kModifierRemappingNeoMod3 references this entry by index. | 89 {// kModifierRemappingNeoMod3 references this entry by index. |
90 ui::EF_MOD3_DOWN | ui::EF_ALTGR_DOWN, | 90 ui::EF_MOD3_DOWN | ui::EF_ALTGR_DOWN, |
91 input_method::kNumModifierKeys, | 91 input_method::kNumModifierKeys, |
92 nullptr, | 92 nullptr, |
93 {ui::EF_MOD3_DOWN | ui::EF_ALTGR_DOWN, ui::DomCode::CAPS_LOCK, | 93 {ui::EF_MOD3_DOWN | ui::EF_ALTGR_DOWN, ui::DomCode::CAPS_LOCK, |
94 ui::DomKey::ALT_GRAPH, ui::VKEY_ALTGR}}, | 94 ui::DomKey::ALT_GRAPH, ui::VKEY_ALTGR}}, |
95 {ui::EF_COMMAND_DOWN, | 95 {ui::EF_COMMAND_DOWN, |
96 input_method::kSearchKey, | 96 input_method::kSearchKey, |
97 prefs::kLanguageRemapSearchKeyTo, | 97 prefs::kLanguageRemapSearchKeyTo, |
98 {ui::EF_COMMAND_DOWN, ui::DomCode::OS_LEFT, ui::DomKey::META, | 98 {ui::EF_COMMAND_DOWN, ui::DomCode::META_LEFT, ui::DomKey::META, |
99 ui::VKEY_LWIN}}, | 99 ui::VKEY_LWIN}}, |
100 {ui::EF_ALT_DOWN, | 100 {ui::EF_ALT_DOWN, |
101 input_method::kAltKey, | 101 input_method::kAltKey, |
102 prefs::kLanguageRemapAltKeyTo, | 102 prefs::kLanguageRemapAltKeyTo, |
103 {ui::EF_ALT_DOWN, ui::DomCode::ALT_LEFT, ui::DomKey::ALT, ui::VKEY_MENU}}, | 103 {ui::EF_ALT_DOWN, ui::DomCode::ALT_LEFT, ui::DomKey::ALT, ui::VKEY_MENU}}, |
104 {ui::EF_NONE, | 104 {ui::EF_NONE, |
105 input_method::kVoidKey, | 105 input_method::kVoidKey, |
106 nullptr, | 106 nullptr, |
107 {ui::EF_NONE, ui::DomCode::NONE, ui::DomKey::NONE, ui::VKEY_UNKNOWN}}, | 107 {ui::EF_NONE, ui::DomCode::NONE, ui::DomKey::NONE, ui::VKEY_UNKNOWN}}, |
108 {ui::EF_MOD3_DOWN, | 108 {ui::EF_MOD3_DOWN, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 switch (code) { | 276 switch (code) { |
277 case ui::DomCode::CONTROL_LEFT: | 277 case ui::DomCode::CONTROL_LEFT: |
278 case ui::DomCode::CONTROL_RIGHT: | 278 case ui::DomCode::CONTROL_RIGHT: |
279 return right ? ui::DomCode::CONTROL_RIGHT : ui::DomCode::CONTROL_LEFT; | 279 return right ? ui::DomCode::CONTROL_RIGHT : ui::DomCode::CONTROL_LEFT; |
280 case ui::DomCode::SHIFT_LEFT: | 280 case ui::DomCode::SHIFT_LEFT: |
281 case ui::DomCode::SHIFT_RIGHT: | 281 case ui::DomCode::SHIFT_RIGHT: |
282 return right ? ui::DomCode::SHIFT_RIGHT : ui::DomCode::SHIFT_LEFT; | 282 return right ? ui::DomCode::SHIFT_RIGHT : ui::DomCode::SHIFT_LEFT; |
283 case ui::DomCode::ALT_LEFT: | 283 case ui::DomCode::ALT_LEFT: |
284 case ui::DomCode::ALT_RIGHT: | 284 case ui::DomCode::ALT_RIGHT: |
285 return right ? ui::DomCode::ALT_RIGHT : ui::DomCode::ALT_LEFT; | 285 return right ? ui::DomCode::ALT_RIGHT : ui::DomCode::ALT_LEFT; |
286 case ui::DomCode::OS_LEFT: | 286 case ui::DomCode::META_LEFT: |
287 case ui::DomCode::OS_RIGHT: | 287 case ui::DomCode::META_RIGHT: |
288 return right ? ui::DomCode::OS_RIGHT : ui::DomCode::OS_LEFT; | 288 return right ? ui::DomCode::META_RIGHT : ui::DomCode::META_LEFT; |
289 default: | 289 default: |
290 break; | 290 break; |
291 } | 291 } |
292 return code; | 292 return code; |
293 } | 293 } |
294 | 294 |
295 } // namespace | 295 } // namespace |
296 | 296 |
297 EventRewriter::EventRewriter(ash::StickyKeysController* sticky_keys_controller) | 297 EventRewriter::EventRewriter(ash::StickyKeysController* sticky_keys_controller) |
298 : last_keyboard_device_id_(ui::ED_UNKNOWN_DEVICE), | 298 : last_keyboard_device_id_(ui::ED_UNKNOWN_DEVICE), |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 // On Chrome OS, XF86XK_Launch7 (F16) with Mod3Mask is sent when Caps Lock | 748 // On Chrome OS, XF86XK_Launch7 (F16) with Mod3Mask is sent when Caps Lock |
749 // is pressed (with one exception: when | 749 // is pressed (with one exception: when |
750 // IsISOLevel5ShiftUsedByCurrentInputMethod() is true, the key generates | 750 // IsISOLevel5ShiftUsedByCurrentInputMethod() is true, the key generates |
751 // XK_ISO_Level3_Shift with Mod3Mask, not XF86XK_Launch7). | 751 // XK_ISO_Level3_Shift with Mod3Mask, not XF86XK_Launch7). |
752 case ui::DomCode::F16: | 752 case ui::DomCode::F16: |
753 case ui::DomCode::CAPS_LOCK: | 753 case ui::DomCode::CAPS_LOCK: |
754 characteristic_flag = ui::EF_CAPS_LOCK_ON; | 754 characteristic_flag = ui::EF_CAPS_LOCK_ON; |
755 remapped_key = | 755 remapped_key = |
756 GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service); | 756 GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service); |
757 break; | 757 break; |
758 case ui::DomCode::OS_LEFT: | 758 case ui::DomCode::META_LEFT: |
759 case ui::DomCode::OS_RIGHT: | 759 case ui::DomCode::META_RIGHT: |
760 characteristic_flag = ui::EF_COMMAND_DOWN; | 760 characteristic_flag = ui::EF_COMMAND_DOWN; |
761 // Rewrite Command-L/R key presses on an Apple keyboard to Control. | 761 // Rewrite Command-L/R key presses on an Apple keyboard to Control. |
762 if (IsAppleKeyboard()) { | 762 if (IsAppleKeyboard()) { |
763 DCHECK_EQ(ui::VKEY_CONTROL, kModifierRemappingCtrl->result.key_code); | 763 DCHECK_EQ(ui::VKEY_CONTROL, kModifierRemappingCtrl->result.key_code); |
764 remapped_key = kModifierRemappingCtrl; | 764 remapped_key = kModifierRemappingCtrl; |
765 } else { | 765 } else { |
766 remapped_key = | 766 remapped_key = |
767 GetRemappedKey(prefs::kLanguageRemapSearchKeyTo, *pref_service); | 767 GetRemappedKey(prefs::kLanguageRemapSearchKeyTo, *pref_service); |
768 } | 768 } |
769 // Default behavior is Super key, hence don't remap the event if the pref | 769 // Default behavior is Super key, hence don't remap the event if the pref |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |