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

Unified Diff: ash/common/accelerators/accelerator_controller.cc

Issue 2183993005: Moves handling of toggling applist back to common code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_window_delegate
Patch Set: merge Created 4 years, 5 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
Index: ash/common/accelerators/accelerator_controller.cc
diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc
index 28afb1f0e9f13623d6f094ba1472d50e2387f34f..ef5c7a35a53c28bbc2c95142087066724dde609d 100644
--- a/ash/common/accelerators/accelerator_controller.cc
+++ b/ash/common/accelerators/accelerator_controller.cc
@@ -199,6 +199,32 @@ void HandleSwitchIme(ImeControlDelegate* ime_control_delegate,
ime_control_delegate->HandleSwitchIme(accelerator);
}
+bool CanHandleToggleAppList(const ui::Accelerator& accelerator,
+ const ui::Accelerator& previous_accelerator) {
+ if (accelerator.key_code() == ui::VKEY_LWIN) {
+ // If something else was pressed between the Search key (LWIN)
+ // being pressed and released, then ignore the release of the
+ // Search key.
+ if (previous_accelerator.type() != ui::ET_KEY_PRESSED ||
+ previous_accelerator.key_code() != ui::VKEY_LWIN) {
+ return false;
+ }
+
+ // When spoken feedback is enabled, we should neither toggle the list nor
+ // consume the key since Search+Shift is one of the shortcuts the a11y
+ // feature uses. crbug.com/132296
+ if (WmShell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled())
+ return false;
+ }
+ return true;
+}
+
+void HandleToggleAppList(const ui::Accelerator& accelerator) {
+ if (accelerator.key_code() == ui::VKEY_LWIN)
+ base::RecordAction(UserMetricsAction("Accel_Search_LWin"));
+ WmShell::Get()->ToggleAppList();
+}
+
void HandleToggleFullscreen(const ui::Accelerator& accelerator) {
if (accelerator.key_code() == ui::VKEY_MEDIA_LAUNCH_APP2)
base::RecordAction(UserMetricsAction("Accel_Fullscreen_F4"));
@@ -633,6 +659,8 @@ bool AcceleratorController::CanPerformAction(
return CanHandlePreviousIme(ime_control_delegate_.get());
case SWITCH_IME:
return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator);
+ case TOGGLE_APP_LIST:
+ return CanHandleToggleAppList(accelerator, previous_accelerator);
case WINDOW_CYCLE_SNAP_DOCK_LEFT:
case WINDOW_CYCLE_SNAP_DOCK_RIGHT:
return CanHandleWindowSnapOrDock();
@@ -775,6 +803,9 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
case SWITCH_IME:
HandleSwitchIme(ime_control_delegate_.get(), accelerator);
break;
+ case TOGGLE_APP_LIST:
+ HandleToggleAppList(accelerator);
+ break;
case TOGGLE_FULLSCREEN:
HandleToggleFullscreen(accelerator);
break;
« no previous file with comments | « ash/accelerators/accelerator_controller_delegate_aura.cc ('k') | ash/mus/accelerators/accelerator_controller_delegate_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698