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

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

Issue 2293183002: ash: Remove ash::Shelf in favor of ash::WmShelf (Closed)
Patch Set: rebase again Created 4 years, 4 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
« no previous file with comments | « ash/aura/wm_root_window_controller_aura.cc ('k') | ash/common/shelf/shelf.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/accelerators/accelerator_controller.cc
diff --git a/ash/common/accelerators/accelerator_controller.cc b/ash/common/accelerators/accelerator_controller.cc
index 6353e975142dcb8928ee5a1400e9520d4ec2d4f1..bd150611ab1a0f3f5772595acc9fbdef46af9241 100644
--- a/ash/common/accelerators/accelerator_controller.cc
+++ b/ash/common/accelerators/accelerator_controller.cc
@@ -15,6 +15,7 @@
#include "ash/common/multi_profile_uma.h"
#include "ash/common/new_window_delegate.h"
#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/shelf/shelf_widget.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shell_delegate.h"
#include "ash/common/system/brightness_control_delegate.h"
@@ -106,6 +107,23 @@ void HandleRotatePaneFocus(FocusCycler::Direction direction) {
WmShell::Get()->focus_cycler()->RotateFocus(direction);
}
+void HandleFocusShelf() {
+ base::RecordAction(UserMetricsAction("Accel_Focus_Shelf"));
+ // TODO(jamescook): Should this be GetRootWindowForNewWindows()?
+ WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow());
+ WmShell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
+}
+
+void HandleLaunchAppN(int n) {
+ base::RecordAction(UserMetricsAction("Accel_Launch_App"));
+ WmShelf::LaunchShelfItem(n);
+}
+
+void HandleLaunchLastApp() {
+ base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
+ WmShelf::LaunchShelfItem(-1);
+}
+
void HandleMediaNextTrack() {
WmShell::Get()->media_delegate()->HandleMediaNextTrack();
}
@@ -302,11 +320,9 @@ void HandlePositionCenter() {
void HandleShowImeMenuBubble() {
base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
- StatusAreaWidget* status_area_widget = ash::WmShell::Get()
- ->GetPrimaryRootWindow()
- ->GetRootWindowController()
- ->GetShelf()
- ->GetStatusAreaWidget();
+ StatusAreaWidget* status_area_widget =
+ WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow())
+ ->GetStatusAreaWidget();
if (status_area_widget) {
ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray();
if (ime_menu_tray && ime_menu_tray->visible() &&
@@ -743,6 +759,16 @@ bool AcceleratorController::CanPerformAction(
case EXIT:
case FOCUS_NEXT_PANE:
case FOCUS_PREVIOUS_PANE:
+ case FOCUS_SHELF:
+ case LAUNCH_APP_0:
+ case LAUNCH_APP_1:
+ case LAUNCH_APP_2:
+ case LAUNCH_APP_3:
+ case LAUNCH_APP_4:
+ case LAUNCH_APP_5:
+ case LAUNCH_APP_6:
+ case LAUNCH_APP_7:
+ case LAUNCH_LAST_APP:
case MEDIA_NEXT_TRACK:
case MEDIA_PLAY_PAUSE:
case MEDIA_PREV_TRACK:
@@ -818,6 +844,36 @@ void AcceleratorController::PerformAction(AcceleratorAction action,
case FOCUS_PREVIOUS_PANE:
HandleRotatePaneFocus(FocusCycler::BACKWARD);
break;
+ case FOCUS_SHELF:
+ HandleFocusShelf();
+ break;
+ case LAUNCH_APP_0:
+ HandleLaunchAppN(0);
+ break;
+ case LAUNCH_APP_1:
+ HandleLaunchAppN(1);
+ break;
+ case LAUNCH_APP_2:
+ HandleLaunchAppN(2);
+ break;
+ case LAUNCH_APP_3:
+ HandleLaunchAppN(3);
+ break;
+ case LAUNCH_APP_4:
+ HandleLaunchAppN(4);
+ break;
+ case LAUNCH_APP_5:
+ HandleLaunchAppN(5);
+ break;
+ case LAUNCH_APP_6:
+ HandleLaunchAppN(6);
+ break;
+ case LAUNCH_APP_7:
+ HandleLaunchAppN(7);
+ break;
+ case LAUNCH_LAST_APP:
+ HandleLaunchLastApp();
+ break;
case MEDIA_NEXT_TRACK:
HandleMediaNextTrack();
break;
« no previous file with comments | « ash/aura/wm_root_window_controller_aura.cc ('k') | ash/common/shelf/shelf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698