Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/chromeos/events/event_rewriter.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 } 742 }
743 743
744 // Remapping based on DomCode. 744 // Remapping based on DomCode.
745 switch (incoming.code) { 745 switch (incoming.code) {
746 // On Chrome OS, XF86XK_Launch7 (F16) with Mod3Mask is sent when Caps Lock 746 // On Chrome OS, XF86XK_Launch7 (F16) with Mod3Mask is sent when Caps Lock
747 // is pressed (with one exception: when 747 // is pressed (with one exception: when
748 // IsISOLevel5ShiftUsedByCurrentInputMethod() is true, the key generates 748 // IsISOLevel5ShiftUsedByCurrentInputMethod() is true, the key generates
749 // XK_ISO_Level3_Shift with Mod3Mask, not XF86XK_Launch7). 749 // XK_ISO_Level3_Shift with Mod3Mask, not XF86XK_Launch7).
750 case ui::DomCode::F16: 750 case ui::DomCode::F16:
751 case ui::DomCode::CAPS_LOCK: 751 case ui::DomCode::CAPS_LOCK:
752 characteristic_flag = ui::EF_CAPS_LOCK_DOWN; 752 characteristic_flag = ui::EF_CAPS_LOCK_ON;
753 remapped_key = 753 remapped_key =
754 GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service); 754 GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service);
755 break; 755 break;
756 case ui::DomCode::OS_LEFT: 756 case ui::DomCode::OS_LEFT:
757 case ui::DomCode::OS_RIGHT: 757 case ui::DomCode::OS_RIGHT:
758 characteristic_flag = ui::EF_COMMAND_DOWN; 758 characteristic_flag = ui::EF_COMMAND_DOWN;
759 // Rewrite Command-L/R key presses on an Apple keyboard to Control. 759 // Rewrite Command-L/R key presses on an Apple keyboard to Control.
760 if (IsAppleKeyboard()) { 760 if (IsAppleKeyboard()) {
761 DCHECK_EQ(ui::VKEY_CONTROL, kModifierRemappingCtrl->result.key_code); 761 DCHECK_EQ(ui::VKEY_CONTROL, kModifierRemappingCtrl->result.key_code);
762 remapped_key = kModifierRemappingCtrl; 762 remapped_key = kModifierRemappingCtrl;
(...skipping 21 matching lines...) Expand all
784 break; 784 break;
785 } 785 }
786 786
787 if (remapped_key) { 787 if (remapped_key) {
788 state->key_code = remapped_key->result.key_code; 788 state->key_code = remapped_key->result.key_code;
789 state->code = remapped_key->result.code; 789 state->code = remapped_key->result.code;
790 state->key = remapped_key->result.key; 790 state->key = remapped_key->result.key;
791 incoming.flags |= characteristic_flag; 791 incoming.flags |= characteristic_flag;
792 characteristic_flag = remapped_key->flag; 792 characteristic_flag = remapped_key->flag;
793 if (remapped_key->remap_to == input_method::kCapsLockKey) 793 if (remapped_key->remap_to == input_method::kCapsLockKey)
794 characteristic_flag |= ui::EF_CAPS_LOCK_DOWN; 794 characteristic_flag |= ui::EF_CAPS_LOCK_ON;
795 state->code = RelocateModifier( 795 state->code = RelocateModifier(
796 state->code, ui::KeycodeConverter::DomCodeToLocation(incoming.code)); 796 state->code, ui::KeycodeConverter::DomCodeToLocation(incoming.code));
797 } 797 }
798 798
799 // Next, remap modifier bits. 799 // Next, remap modifier bits.
800 state->flags |= 800 state->flags |=
801 GetRemappedModifierMasks(*pref_service, key_event, incoming.flags); 801 GetRemappedModifierMasks(*pref_service, key_event, incoming.flags);
802 802
803 // If the DomKey is not a modifier before remapping but is after, set the 803 // If the DomKey is not a modifier before remapping but is after, set the
804 // modifier latches for the later non-modifier key's modifier states. 804 // modifier latches for the later non-modifier key's modifier states.
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 for (const auto& keyboard : keyboards) { 1145 for (const auto& keyboard : keyboards) {
1146 if (keyboard.id == device_id) { 1146 if (keyboard.id == device_id) {
1147 return KeyboardDeviceAddedInternal( 1147 return KeyboardDeviceAddedInternal(
1148 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id); 1148 keyboard.id, keyboard.name, keyboard.vendor_id, keyboard.product_id);
1149 } 1149 }
1150 } 1150 }
1151 return kDeviceUnknown; 1151 return kDeviceUnknown;
1152 } 1152 }
1153 1153
1154 } // namespace chromeos 1154 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698