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

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: impl. of review comments 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
« 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 31b5e9203d149d7f93624cc993aa3c4c79da5227..8296212682a3153061085b0531f3ead882a0d0fd 100644
--- a/ash/accelerators/accelerator_controller.cc
+++ b/ash/accelerators/accelerator_controller.cc
@@ -359,12 +359,12 @@ void AcceleratorController::Init() {
actions_allowed_at_lock_screen_.insert(
kActionsAllowedAtLoginOrLockScreen[i]);
}
- for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i) {
+ for (size_t i = 0; i < kActionsAllowedAtLockScreenLength; ++i)
actions_allowed_at_lock_screen_.insert(kActionsAllowedAtLockScreen[i]);
- }
- for (size_t i = 0; i < kReservedActionsLength; ++i) {
+ for (size_t i = 0; i < kActionsAllowedAtModalWindowLength; ++i)
+ actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]);
+ for (size_t i = 0; i < kReservedActionsLength; ++i)
reserved_actions_.insert(kReservedActions[i]);
- }
RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength);
@@ -421,18 +421,25 @@ bool AcceleratorController::PerformAction(int action,
#if defined(OS_CHROMEOS)
at_login_screen = shell->delegate() && !shell->delegate()->IsSessionStarted();
#endif
- bool at_lock_screen = shell->IsScreenLocked();
-
if (at_login_screen &&
actions_allowed_at_login_screen_.find(action) ==
actions_allowed_at_login_screen_.end()) {
return false;
}
- if (at_lock_screen &&
+ if (shell->IsScreenLocked() &&
actions_allowed_at_lock_screen_.find(action) ==
actions_allowed_at_lock_screen_.end()) {
return false;
}
+ if (shell->IsModalWindowOpen() &&
+ 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 =
« 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