| Index: ash/accelerators/accelerator_controller.cc
|
| diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc
|
| index 7bb9643fbaf7aba62b4262a53b6a566bbf51d17f..ac022dca2994cd672eedcaa0253c0c4f499fe3d5 100644
|
| --- a/ash/accelerators/accelerator_controller.cc
|
| +++ b/ash/accelerators/accelerator_controller.cc
|
| @@ -857,36 +857,10 @@ bool AcceleratorController::IsReservedAccelerator(
|
| bool AcceleratorController::PerformAction(int action,
|
| const ui::Accelerator& accelerator) {
|
| ash::Shell* shell = ash::Shell::GetInstance();
|
| - if (!shell->session_state_delegate()->IsActiveUserSessionStarted() &&
|
| - actions_allowed_at_login_screen_.find(action) ==
|
| - actions_allowed_at_login_screen_.end()) {
|
| - return false;
|
| - }
|
| - if (shell->session_state_delegate()->IsScreenLocked() &&
|
| - actions_allowed_at_lock_screen_.find(action) ==
|
| - actions_allowed_at_lock_screen_.end()) {
|
| - return false;
|
| - }
|
| - if (shell->IsSystemModalWindowOpen() &&
|
| - 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;
|
| - }
|
| - if (shell->delegate()->IsRunningInForcedAppMode() &&
|
| - actions_allowed_in_app_mode_.find(action) ==
|
| - actions_allowed_in_app_mode_.end()) {
|
| - return false;
|
| - }
|
| - if (MruWindowTracker::BuildWindowList(false).empty() &&
|
| - actions_needing_window_.find(action) != actions_needing_window_.end()) {
|
| - Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert(
|
| - A11Y_ALERT_WINDOW_NEEDED);
|
| - return true;
|
| - }
|
| + AcceleratorProcessRestriction restriction =
|
| + GetAcceleratorProcessRestriction(action, accelerator);
|
| + if (restriction != RESTRICTION_NONE)
|
| + return restriction == RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
|
|
|
| const ui::KeyboardCode key_code = accelerator.key_code();
|
| // PerformAction() is performed from gesture controllers and passes
|
| @@ -1140,6 +1114,44 @@ bool AcceleratorController::PerformAction(int action,
|
| return false;
|
| }
|
|
|
| +AcceleratorController::AcceleratorProcessRestriction
|
| +AcceleratorController::GetAcceleratorProcessRestriction(
|
| + int action,
|
| + ui::Accelerator accelerator) {
|
| + ash::Shell* shell = ash::Shell::GetInstance();
|
| + if (!shell->session_state_delegate()->IsActiveUserSessionStarted() &&
|
| + actions_allowed_at_login_screen_.find(action) ==
|
| + actions_allowed_at_login_screen_.end()) {
|
| + return RESTRICTION_PREVENT_PROCESSING;
|
| + }
|
| + if (shell->session_state_delegate()->IsScreenLocked() &&
|
| + actions_allowed_at_lock_screen_.find(action) ==
|
| + actions_allowed_at_lock_screen_.end()) {
|
| + return RESTRICTION_PREVENT_PROCESSING;
|
| + }
|
| + if (shell->IsSystemModalWindowOpen() &&
|
| + actions_allowed_at_modal_window_.find(action) ==
|
| + actions_allowed_at_modal_window_.end()) {
|
| + // Note we prevent the shortcut from propagating so it 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 RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
|
| + }
|
| + if (shell->delegate()->IsRunningInForcedAppMode() &&
|
| + actions_allowed_in_app_mode_.find(action) ==
|
| + actions_allowed_in_app_mode_.end()) {
|
| + return RESTRICTION_PREVENT_PROCESSING;
|
| + }
|
| + if (MruWindowTracker::BuildWindowList(false).empty() &&
|
| + actions_needing_window_.find(action) != actions_needing_window_.end()) {
|
| + Shell::GetInstance()->accessibility_delegate()->TriggerAccessibilityAlert(
|
| + A11Y_ALERT_WINDOW_NEEDED);
|
| + return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
|
| + }
|
| + return RESTRICTION_NONE;
|
| +}
|
| +
|
| void AcceleratorController::SetBrightnessControlDelegate(
|
| scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) {
|
| brightness_control_delegate_ = brightness_control_delegate.Pass();
|
|
|