diff options
author | pkotwicz <pkotwicz@chromium.org> | 2014-10-20 15:51:50 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-20 22:52:12 +0000 |
commit | 7749fc5773c32fd67da38aa8f9e849fd14f4a64e (patch) | |
tree | 0cfeac233f8b8cc2dc93137990651ad8c6f53001 /ash/accelerators | |
parent | e7ec38df8d1966cc871961e72dda8865ce68a3cc (diff) | |
download | chromium_src-7749fc5773c32fd67da38aa8f9e849fd14f4a64e.zip chromium_src-7749fc5773c32fd67da38aa8f9e849fd14f4a64e.tar.gz chromium_src-7749fc5773c32fd67da38aa8f9e849fd14f4a64e.tar.bz2 |
Return false in AcceleratorController::Process() if an accelerator has no effect
This CL allows web pages to intercept the Ctrl+Shift+0 accelerator when no UI scaling is applied (which is the common case)
BUG=404473
TEST=None
Review URL: https://codereview.chromium.org/668573002
Cr-Commit-Position: refs/heads/master@{#300370}
Diffstat (limited to 'ash/accelerators')
-rw-r--r-- | ash/accelerators/accelerator_controller.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index d2db14e..dcbb39a 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -180,14 +180,15 @@ bool HandleMagnifyScreen(int delta_index) { ash::Shell::GetInstance()->magnification_controller()-> SetScale(std::pow(kMagnificationScaleFactor, new_scale_index), true); + return true; } else if (ash::Shell::GetInstance()-> partial_magnification_controller()->is_enabled()) { float scale = delta_index > 0 ? kDefaultPartialMagnifiedScale : 1; ash::Shell::GetInstance()->partial_magnification_controller()-> SetScale(scale); + return true; } - - return true; + return false; } bool HandleMediaNextTrack() { @@ -356,8 +357,13 @@ bool HandleScaleReset() { base::RecordAction(UserMetricsAction("Accel_Scale_Ui_Reset")); - display_manager->SetDisplayUIScale(display_id, 1.0f); - return true; + float ui_scale = + display_manager->GetDisplayInfo(display_id).configured_ui_scale(); + if (ui_scale != 1.0f) { + display_manager->SetDisplayUIScale(display_id, 1.0f); + return true; + } + return false; } bool HandleScaleUI(bool up) { @@ -393,7 +399,7 @@ bool HandleShowKeyboardOverlay() { return true; } -void HandleShowMessageCenterBubble() { +bool HandleShowMessageCenterBubble() { base::RecordAction(UserMetricsAction("Accel_Show_Message_Center_Bubble")); RootWindowController* controller = RootWindowController::ForTargetRootWindow(); @@ -402,9 +408,12 @@ void HandleShowMessageCenterBubble() { if (status_area_widget) { WebNotificationTray* notification_tray = status_area_widget->web_notification_tray(); - if (notification_tray->visible()) + if (notification_tray->visible()) { notification_tray->ShowMessageCenterBubble(); + return true; + } } + return false; } bool HandleShowSystemTrayBubble() { @@ -1012,8 +1021,7 @@ bool AcceleratorController::PerformAction(int action, case SHOW_SYSTEM_TRAY_BUBBLE: return HandleShowSystemTrayBubble(); case SHOW_MESSAGE_CENTER_BUBBLE: - HandleShowMessageCenterBubble(); - break; + return HandleShowMessageCenterBubble(); case SHOW_TASK_MANAGER: return HandleShowTaskManager(); case NEXT_IME: |