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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 11364168: Add a workaround for crbug.com/139556. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed unused var Created 8 years, 1 month 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 | « ash/accelerators/accelerator_controller.h ('k') | 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 c37a883d88bae5156c00a2fdcaf7d89b12a29085..5520e98247cfb254efbd58487a2108b7d61df019 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -310,19 +310,15 @@ bool HandlePrintWindowHierarchy() {
////////////////////////////////////////////////////////////////////////////////
// AcceleratorControllerContext, public:
-AcceleratorControllerContext::AcceleratorControllerContext()
- : repeated_(false),
- previous_event_type_(ui::ET_UNKNOWN) {
+AcceleratorControllerContext::AcceleratorControllerContext() {
+ current_accelerator_.set_type(ui::ET_UNKNOWN);
+ previous_accelerator_.set_type(ui::ET_UNKNOWN);
}
void AcceleratorControllerContext::UpdateContext(
const ui::Accelerator& accelerator) {
- const ui::Accelerator previous_accelerator = current_accelerator_;
+ previous_accelerator_ = current_accelerator_;
current_accelerator_ = accelerator;
-
- // Compute contextual information.
- repeated_ = previous_accelerator == current_accelerator_;
- previous_event_type_ = previous_accelerator.type();
}
////////////////////////////////////////////////////////////////////////////////
@@ -444,7 +440,8 @@ bool AcceleratorController::PerformAction(int action,
return true;
}
// Type of the previous accelerator. Used by NEXT_IME and DISABLE_CAPS_LOCK.
- const ui::EventType previous_event_type = context_.previous_event_type();
+ const ui::EventType previous_event_type =
+ context_.previous_accelerator().type();
// You *MUST* return true when some action is performed. Otherwise, this
// function might be called *twice*, via BrowserView::PreHandleKeyboardEvent
@@ -617,7 +614,15 @@ bool AcceleratorController::PerformAction(int action,
// ET_KEY_RELEASED accelerator for Chrome OS (see ash/accelerators/
// accelerator_controller.cc) when Shift+Alt+Tab is pressed and then Tab
// is released.
- if (previous_event_type == ui::ET_KEY_RELEASED) {
+ if (previous_event_type == ui::ET_KEY_RELEASED &&
+ // Workaround for crbug.com/139556. CJK IME users tend to press
+ // Enter (or Space) and Shift+Alt almost at the same time to commit
+ // an IME string and then switch from the IME to the English layout.
+ // This workaround allows the user to trigger NEXT_IME even if the
+ // user presses Shift+Alt before releasing Enter.
+ // TODO(nona|mazda): Fix crbug.com/139556 in a cleaner way.
+ context_.previous_accelerator().key_code() != ui::VKEY_RETURN &&
+ context_.previous_accelerator().key_code() != ui::VKEY_SPACE) {
// We totally ignore this accelerator.
// TODO(mazda): Fix crbug.com/158217
return false;
« no previous file with comments | « ash/accelerators/accelerator_controller.h ('k') | ash/accelerators/accelerator_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698