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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 2763483002: Fix Caps Lock bug (Closed)
Patch Set: Failure due to file directory change, apply the fix Created 3 years, 8 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 | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 4629356c726696c08b0915debd453c86d51df4c8..4e06455c59a0d117434af3e32157e1a62d03a814 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -551,6 +551,8 @@ bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator,
const ui::Accelerator& previous_accelerator) {
chromeos::input_method::InputMethodManager* ime =
chromeos::input_method::InputMethodManager::Get();
+ if (!ime)
+ return false;
// This shortcust is set to be trigger on release. Either the current
// accelerator is a Search release or Alt release.
@@ -563,7 +565,7 @@ bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator,
ui::Accelerator::KeyState::PRESSED &&
(previous_accelerator.key_code() == ui::VKEY_LWIN ||
previous_accelerator.key_code() == ui::VKEY_MENU)) {
- return ime && ime->GetImeKeyboard();
+ return ime->GetImeKeyboard();
}
}
@@ -577,10 +579,16 @@ bool CanHandleToggleCapsLock(const ui::Accelerator& accelerator,
ui::Accelerator::KeyState::PRESSED &&
(previous_accelerator.key_code() == ui::VKEY_LWIN ||
previous_accelerator.key_code() == ui::VKEY_MENU)) {
- return ime && ime->GetImeKeyboard();
+ return ime->GetImeKeyboard();
}
}
+ // Caps Lock release
+ if (accelerator.key_code() == ui::VKEY_CAPITAL &&
+ accelerator.key_state() == ui::Accelerator::KeyState::RELEASED) {
+ return ime->GetImeKeyboard();
+ }
+
return false;
}
« no previous file with comments | « no previous file | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698