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

Unified Diff: ash/accelerators/accelerator_controller.cc

Issue 10977088: Fix for Ash shortcuts unexpectedly working in system model dialog (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: adding unit tests Created 8 years, 2 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
Index: ash/accelerators/accelerator_controller.cc
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
index 31b5e9203d149d7f93624cc993aa3c4c79da5227..94cbd55ad8dd828b9d082d6f7b1b8c81a158b2d4 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -362,6 +362,9 @@ void AcceleratorController::Init() {
for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) {
actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]);
}
+ for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i) {
Daniel Erat 2012/10/16 03:03:50 nit: not your fault, but i won't object if you wan
sschmitz 2012/10/16 18:18:23 Done.
+ actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]);
+ }
for (size_t i = 0; i < kReservedActionsLength; ++i) {
reserved_actions_.insert(kReservedActions[i]);
}
@@ -422,6 +425,7 @@ bool AcceleratorController::PerformAction(int action,
at_login_screen = shell->delegate() && !shell->delegate()->IsSessionStarted();
#endif
bool at_lock_screen = shell->IsScreenLocked();
+ bool at_modal_window = shell->IsModalWindowOpen();
Daniel Erat 2012/10/16 03:03:50 nit: i don't think that there's any reason to crea
sschmitz 2012/10/16 18:18:23 Done.
if (at_login_screen &&
actions_allowed_at_login_screen_.find(action) ==
@@ -433,6 +437,15 @@ bool AcceleratorController::PerformAction(int action,
actions_allowed_at_lock_screen_.end()) {
return false;
}
+ if (at_modal_window &&
+ actions_allowed_at_modal_window_.find(action) ==
+ actions_allowed_at_modal_window_.end()) {
+ // Note: we return true. This indicates the shortcut is handled
+ // and will not be passed to the modal window. This is important
+ // for things like Alt+Tab that would cause an undesired effect
+ // in the modal window by cycling through its window elements.
+ return true;
+ }
const ui::KeyboardCode key_code = accelerator.key_code();
const ui::AcceleratorManagerContext& context =

Powered by Google App Engine
This is Rietveld 408576698