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

Side by Side 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, 3 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/accelerators/accelerator_controller.h" 5 #include "ash/common/accelerators/accelerator_controller.h"
6 6
7 #include "ash/common/accelerators/accelerator_commands.h" 7 #include "ash/common/accelerators/accelerator_commands.h"
8 #include "ash/common/accelerators/accelerator_controller_delegate.h" 8 #include "ash/common/accelerators/accelerator_controller_delegate.h"
9 #include "ash/common/accelerators/debug_commands.h" 9 #include "ash/common/accelerators/debug_commands.h"
10 #include "ash/common/accessibility_delegate.h" 10 #include "ash/common/accessibility_delegate.h"
11 #include "ash/common/accessibility_types.h" 11 #include "ash/common/accessibility_types.h"
12 #include "ash/common/focus_cycler.h" 12 #include "ash/common/focus_cycler.h"
13 #include "ash/common/ime_control_delegate.h" 13 #include "ash/common/ime_control_delegate.h"
14 #include "ash/common/media_delegate.h" 14 #include "ash/common/media_delegate.h"
15 #include "ash/common/multi_profile_uma.h" 15 #include "ash/common/multi_profile_uma.h"
16 #include "ash/common/new_window_delegate.h" 16 #include "ash/common/new_window_delegate.h"
17 #include "ash/common/session/session_state_delegate.h" 17 #include "ash/common/session/session_state_delegate.h"
18 #include "ash/common/shelf/shelf_widget.h"
18 #include "ash/common/shelf/wm_shelf.h" 19 #include "ash/common/shelf/wm_shelf.h"
19 #include "ash/common/shell_delegate.h" 20 #include "ash/common/shell_delegate.h"
20 #include "ash/common/system/brightness_control_delegate.h" 21 #include "ash/common/system/brightness_control_delegate.h"
21 #include "ash/common/system/keyboard_brightness_control_delegate.h" 22 #include "ash/common/system/keyboard_brightness_control_delegate.h"
22 #include "ash/common/system/status_area_widget.h" 23 #include "ash/common/system/status_area_widget.h"
23 #include "ash/common/system/tray/system_tray_delegate.h" 24 #include "ash/common/system/tray/system_tray_delegate.h"
24 #include "ash/common/system/tray/system_tray_notifier.h" 25 #include "ash/common/system/tray/system_tray_notifier.h"
25 #include "ash/common/system/volume_control_delegate.h" 26 #include "ash/common/system/volume_control_delegate.h"
26 #include "ash/common/wm/mru_window_tracker.h" 27 #include "ash/common/wm/mru_window_tracker.h"
27 #include "ash/common/wm/overview/window_selector_controller.h" 28 #include "ash/common/wm/overview/window_selector_controller.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 break; 100 break;
100 } 101 }
101 case FocusCycler::BACKWARD: { 102 case FocusCycler::BACKWARD: {
102 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); 103 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane"));
103 break; 104 break;
104 } 105 }
105 } 106 }
106 WmShell::Get()->focus_cycler()->RotateFocus(direction); 107 WmShell::Get()->focus_cycler()->RotateFocus(direction);
107 } 108 }
108 109
110 void HandleFocusShelf() {
111 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf"));
112 // TODO(jamescook): Should this be GetRootWindowForNewWindows()?
113 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow());
114 WmShell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget());
115 }
116
117 void HandleLaunchAppN(int n) {
118 base::RecordAction(UserMetricsAction("Accel_Launch_App"));
119 WmShelf::LaunchShelfItem(n);
120 }
121
122 void HandleLaunchLastApp() {
123 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
124 WmShelf::LaunchShelfItem(-1);
125 }
126
109 void HandleMediaNextTrack() { 127 void HandleMediaNextTrack() {
110 WmShell::Get()->media_delegate()->HandleMediaNextTrack(); 128 WmShell::Get()->media_delegate()->HandleMediaNextTrack();
111 } 129 }
112 130
113 void HandleMediaPlayPause() { 131 void HandleMediaPlayPause() {
114 WmShell::Get()->media_delegate()->HandleMediaPlayPause(); 132 WmShell::Get()->media_delegate()->HandleMediaPlayPause();
115 } 133 }
116 134
117 void HandleMediaPrevTrack() { 135 void HandleMediaPrevTrack() {
118 WmShell::Get()->media_delegate()->HandleMediaPrevTrack(); 136 WmShell::Get()->media_delegate()->HandleMediaPrevTrack();
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 313
296 void HandlePositionCenter() { 314 void HandlePositionCenter() {
297 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 315 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
298 wm::CenterWindow(WmShell::Get()->GetActiveWindow()); 316 wm::CenterWindow(WmShell::Get()->GetActiveWindow());
299 } 317 }
300 318
301 #if defined(OS_CHROMEOS) 319 #if defined(OS_CHROMEOS)
302 void HandleShowImeMenuBubble() { 320 void HandleShowImeMenuBubble() {
303 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble")); 321 base::RecordAction(UserMetricsAction("Accel_Show_Ime_Menu_Bubble"));
304 322
305 StatusAreaWidget* status_area_widget = ash::WmShell::Get() 323 StatusAreaWidget* status_area_widget =
306 ->GetPrimaryRootWindow() 324 WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow())
307 ->GetRootWindowController() 325 ->GetStatusAreaWidget();
308 ->GetShelf()
309 ->GetStatusAreaWidget();
310 if (status_area_widget) { 326 if (status_area_widget) {
311 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray(); 327 ImeMenuTray* ime_menu_tray = status_area_widget->ime_menu_tray();
312 if (ime_menu_tray && ime_menu_tray->visible() && 328 if (ime_menu_tray && ime_menu_tray->visible() &&
313 !ime_menu_tray->IsImeMenuBubbleShown()) { 329 !ime_menu_tray->IsImeMenuBubbleShown()) {
314 ime_menu_tray->ShowImeMenuBubble(); 330 ime_menu_tray->ShowImeMenuBubble();
315 } 331 }
316 } 332 }
317 } 333 }
318 334
319 void HandleCrosh() { 335 void HandleCrosh() {
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 return CanHandleShowStylusTools(); 752 return CanHandleShowStylusTools();
737 case SWITCH_TO_PREVIOUS_USER: 753 case SWITCH_TO_PREVIOUS_USER:
738 case SWITCH_TO_NEXT_USER: 754 case SWITCH_TO_NEXT_USER:
739 return CanHandleCycleUser(); 755 return CanHandleCycleUser();
740 case TOGGLE_CAPS_LOCK: 756 case TOGGLE_CAPS_LOCK:
741 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 757 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
742 #endif 758 #endif
743 case EXIT: 759 case EXIT:
744 case FOCUS_NEXT_PANE: 760 case FOCUS_NEXT_PANE:
745 case FOCUS_PREVIOUS_PANE: 761 case FOCUS_PREVIOUS_PANE:
762 case FOCUS_SHELF:
763 case LAUNCH_APP_0:
764 case LAUNCH_APP_1:
765 case LAUNCH_APP_2:
766 case LAUNCH_APP_3:
767 case LAUNCH_APP_4:
768 case LAUNCH_APP_5:
769 case LAUNCH_APP_6:
770 case LAUNCH_APP_7:
771 case LAUNCH_LAST_APP:
746 case MEDIA_NEXT_TRACK: 772 case MEDIA_NEXT_TRACK:
747 case MEDIA_PLAY_PAUSE: 773 case MEDIA_PLAY_PAUSE:
748 case MEDIA_PREV_TRACK: 774 case MEDIA_PREV_TRACK:
749 case NEW_TAB: 775 case NEW_TAB:
750 case NEW_WINDOW: 776 case NEW_WINDOW:
751 case OPEN_FEEDBACK_PAGE: 777 case OPEN_FEEDBACK_PAGE:
752 case PRINT_UI_HIERARCHIES: 778 case PRINT_UI_HIERARCHIES:
753 case RESTORE_TAB: 779 case RESTORE_TAB:
754 case SHOW_KEYBOARD_OVERLAY: 780 case SHOW_KEYBOARD_OVERLAY:
755 case SHOW_TASK_MANAGER: 781 case SHOW_TASK_MANAGER:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 case EXIT: 837 case EXIT:
812 // UMA metrics are recorded in the handler. 838 // UMA metrics are recorded in the handler.
813 exit_warning_handler_.HandleAccelerator(); 839 exit_warning_handler_.HandleAccelerator();
814 break; 840 break;
815 case FOCUS_NEXT_PANE: 841 case FOCUS_NEXT_PANE:
816 HandleRotatePaneFocus(FocusCycler::FORWARD); 842 HandleRotatePaneFocus(FocusCycler::FORWARD);
817 break; 843 break;
818 case FOCUS_PREVIOUS_PANE: 844 case FOCUS_PREVIOUS_PANE:
819 HandleRotatePaneFocus(FocusCycler::BACKWARD); 845 HandleRotatePaneFocus(FocusCycler::BACKWARD);
820 break; 846 break;
847 case FOCUS_SHELF:
848 HandleFocusShelf();
849 break;
850 case LAUNCH_APP_0:
851 HandleLaunchAppN(0);
852 break;
853 case LAUNCH_APP_1:
854 HandleLaunchAppN(1);
855 break;
856 case LAUNCH_APP_2:
857 HandleLaunchAppN(2);
858 break;
859 case LAUNCH_APP_3:
860 HandleLaunchAppN(3);
861 break;
862 case LAUNCH_APP_4:
863 HandleLaunchAppN(4);
864 break;
865 case LAUNCH_APP_5:
866 HandleLaunchAppN(5);
867 break;
868 case LAUNCH_APP_6:
869 HandleLaunchAppN(6);
870 break;
871 case LAUNCH_APP_7:
872 HandleLaunchAppN(7);
873 break;
874 case LAUNCH_LAST_APP:
875 HandleLaunchLastApp();
876 break;
821 case MEDIA_NEXT_TRACK: 877 case MEDIA_NEXT_TRACK:
822 HandleMediaNextTrack(); 878 HandleMediaNextTrack();
823 break; 879 break;
824 case MEDIA_PLAY_PAUSE: 880 case MEDIA_PLAY_PAUSE:
825 HandleMediaPlayPause(); 881 HandleMediaPlayPause();
826 break; 882 break;
827 case MEDIA_PREV_TRACK: 883 case MEDIA_PREV_TRACK:
828 HandleMediaPrevTrack(); 884 HandleMediaPrevTrack();
829 break; 885 break;
830 case NEW_INCOGNITO_WINDOW: 886 case NEW_INCOGNITO_WINDOW:
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() && 1076 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1021 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1077 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1022 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1078 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
1023 A11Y_ALERT_WINDOW_NEEDED); 1079 A11Y_ALERT_WINDOW_NEEDED);
1024 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1080 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1025 } 1081 }
1026 return RESTRICTION_NONE; 1082 return RESTRICTION_NONE;
1027 } 1083 }
1028 1084
1029 } // namespace ash 1085 } // namespace ash
OLDNEW
« 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