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 = |