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

Unified Diff: chrome/browser/ui/ash/event_rewriter.cc

Issue 13008005: Short-term fix for CapsLock remapping on chromebooks with external keyboard (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Keep existing pref name Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/ui/ash/event_rewriter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/event_rewriter.cc
diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc
index 3c789b196ed4bdde4ca42a7d93e7f80ab6ce938d..9a0a376e9f4d18ed6ef648d59c967d325bb7149b 100644
--- a/chrome/browser/ui/ash/event_rewriter.cc
+++ b/chrome/browser/ui/ash/event_rewriter.cc
@@ -70,7 +70,6 @@ const struct ModifierRemapping {
};
const ModifierRemapping* kModifierRemappingCtrl = &kModifierRemappings[1];
-const ModifierRemapping* kModifierRemappingCapsLock = &kModifierRemappings[4];
// A structure for converting |native_modifier| to a pair of |flag| and
// |pref_name|.
@@ -118,11 +117,6 @@ bool IsRight(KeySym native_keysym) {
return false;
}
-bool HasChromeOSKeyboard() {
- return CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kHasChromeOSKeyboard);
-}
-
bool HasDiamondKey() {
return CommandLine::ForCurrentProcess()->HasSwitch(
switches::kHasChromeOSDiamondKey);
@@ -401,11 +395,9 @@ void EventRewriter::GetRemappedModifierMasks(
// configurable modifier because Mod2Mask may be worked as NumLock mask.
// (cf. http://crbug.com/173956)
const bool skip_mod2 = !HasDiamondKey();
- // When a Chrome OS keyboard is available, the configuration UI for Caps Lock
- // is not shown. Therefore, ignore the kLanguageRemapCapsLockKeyTo syncable
- // pref. If Mod3 is in use, don't check the pref either.
- const bool skip_mod3 =
- HasChromeOSKeyboard() || IsMod3UsedByCurrentInputMethod();
+ // If Mod3 is used by the current input method, don't allow the CapsLock
+ // pref to remap it, or the keyboard behavior will be broken.
+ const bool skip_mod3 = IsMod3UsedByCurrentInputMethod();
for (size_t i = 0; i < arraysize(kModifierFlagToPrefName); ++i) {
if ((skip_mod2 && kModifierFlagToPrefName[i].native_modifier == Mod2Mask) ||
@@ -497,15 +489,8 @@ bool EventRewriter::RewriteModifiers(ui::KeyEvent* event) {
// true, the key generates XK_ISO_Level3_Shift with Mod3Mask, not
// XF86XK_Launch7).
case XF86XK_Launch7:
- // When a Chrome OS keyboard is available, the configuration UI for Caps
- // Lock is not shown. Therefore, ignore the kLanguageRemapCapsLockKeyTo
- // syncable pref.
- if (!HasChromeOSKeyboard())
- remapped_key =
- GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service);
- // Default behavior is Caps Lock key.
- if (!remapped_key)
- remapped_key = kModifierRemappingCapsLock;
+ remapped_key =
+ GetRemappedKey(prefs::kLanguageRemapCapsLockKeyTo, *pref_service);
break;
case XK_Super_L:
case XK_Super_R:
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | chrome/browser/ui/ash/event_rewriter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698