X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fash%2Faccelerators%2Faccelerator_controller.cc;h=289c4d56df089f3f6a4fee06b14fa9333e01bb47;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=7bb9643fbaf7aba62b4262a53b6a566bbf51d17f;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/ash/accelerators/accelerator_controller.cc b/src/ash/accelerators/accelerator_controller.cc index 7bb9643..289c4d5 100644 --- a/src/ash/accelerators/accelerator_controller.cc +++ b/src/ash/accelerators/accelerator_controller.cc @@ -229,7 +229,7 @@ bool HandleNewWindow() { return true; } -bool HandleNextIme(ImeControlDelegate* ime_control_delegate, +void HandleNextIme(ImeControlDelegate* ime_control_delegate, ui::EventType previous_event_type, ui::KeyboardCode previous_key_code) { // This check is necessary e.g. not to process the Shift+Alt+ @@ -247,12 +247,11 @@ bool HandleNextIme(ImeControlDelegate* ime_control_delegate, previous_key_code != ui::VKEY_SPACE) { // We totally ignore this accelerator. // TODO(mazda): Fix crbug.com/158217 - return false; + return; } base::RecordAction(UserMetricsAction("Accel_Next_Ime")); if (ime_control_delegate) - return ime_control_delegate->HandleNextIme(); - return false; + ime_control_delegate->HandleNextIme(); } bool HandleOpenFeedbackPage() { @@ -857,36 +856,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; - } + AcceleratorProcessingRestriction restriction = + GetAcceleratorProcessingRestriction(action); + 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 @@ -1034,8 +1007,11 @@ bool AcceleratorController::PerformAction(int action, case SHOW_TASK_MANAGER: return HandleShowTaskManager(); case NEXT_IME: - return HandleNextIme( + HandleNextIme( ime_control_delegate_.get(), previous_event_type, previous_key_code); + // NEXT_IME is bound to Alt-Shift key up event. To be consistent with + // Windows behavior, do not consume the key event here. + return false; case PREVIOUS_IME: return HandlePreviousIme(ime_control_delegate_.get(), accelerator); case PRINT_UI_HIERARCHIES: @@ -1140,6 +1116,47 @@ bool AcceleratorController::PerformAction(int action, return false; } +AcceleratorController::AcceleratorProcessingRestriction +AcceleratorController::GetCurrentAcceleratorRestriction() { + return GetAcceleratorProcessingRestriction(-1); +} + +AcceleratorController::AcceleratorProcessingRestriction +AcceleratorController::GetAcceleratorProcessingRestriction(int action) { + 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 brightness_control_delegate) { brightness_control_delegate_ = brightness_control_delegate.Pass();