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

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 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
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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 return CanHandleShowStylusTools(); 754 return CanHandleShowStylusTools();
737 case SWITCH_TO_PREVIOUS_USER: 755 case SWITCH_TO_PREVIOUS_USER:
738 case SWITCH_TO_NEXT_USER: 756 case SWITCH_TO_NEXT_USER:
739 return CanHandleCycleUser(); 757 return CanHandleCycleUser();
740 case TOGGLE_CAPS_LOCK: 758 case TOGGLE_CAPS_LOCK:
741 return CanHandleToggleCapsLock(accelerator, previous_accelerator); 759 return CanHandleToggleCapsLock(accelerator, previous_accelerator);
742 #endif 760 #endif
743 case EXIT: 761 case EXIT:
744 case FOCUS_NEXT_PANE: 762 case FOCUS_NEXT_PANE:
745 case FOCUS_PREVIOUS_PANE: 763 case FOCUS_PREVIOUS_PANE:
764 case FOCUS_SHELF:
765 case LAUNCH_APP_0:
766 case LAUNCH_APP_1:
767 case LAUNCH_APP_2:
768 case LAUNCH_APP_3:
769 case LAUNCH_APP_4:
770 case LAUNCH_APP_5:
771 case LAUNCH_APP_6:
772 case LAUNCH_APP_7:
773 case LAUNCH_LAST_APP:
746 case MEDIA_NEXT_TRACK: 774 case MEDIA_NEXT_TRACK:
747 case MEDIA_PLAY_PAUSE: 775 case MEDIA_PLAY_PAUSE:
748 case MEDIA_PREV_TRACK: 776 case MEDIA_PREV_TRACK:
749 case NEW_TAB: 777 case NEW_TAB:
750 case NEW_WINDOW: 778 case NEW_WINDOW:
751 case OPEN_FEEDBACK_PAGE: 779 case OPEN_FEEDBACK_PAGE:
752 case PRINT_UI_HIERARCHIES: 780 case PRINT_UI_HIERARCHIES:
753 case RESTORE_TAB: 781 case RESTORE_TAB:
754 case SHOW_KEYBOARD_OVERLAY: 782 case SHOW_KEYBOARD_OVERLAY:
755 case SHOW_TASK_MANAGER: 783 case SHOW_TASK_MANAGER:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 case EXIT: 839 case EXIT:
812 // UMA metrics are recorded in the handler. 840 // UMA metrics are recorded in the handler.
813 exit_warning_handler_.HandleAccelerator(); 841 exit_warning_handler_.HandleAccelerator();
814 break; 842 break;
815 case FOCUS_NEXT_PANE: 843 case FOCUS_NEXT_PANE:
816 HandleRotatePaneFocus(FocusCycler::FORWARD); 844 HandleRotatePaneFocus(FocusCycler::FORWARD);
817 break; 845 break;
818 case FOCUS_PREVIOUS_PANE: 846 case FOCUS_PREVIOUS_PANE:
819 HandleRotatePaneFocus(FocusCycler::BACKWARD); 847 HandleRotatePaneFocus(FocusCycler::BACKWARD);
820 break; 848 break;
849 case FOCUS_SHELF:
850 HandleFocusShelf();
851 break;
852 case LAUNCH_APP_0:
853 HandleLaunchAppN(0);
854 break;
855 case LAUNCH_APP_1:
856 HandleLaunchAppN(1);
857 break;
858 case LAUNCH_APP_2:
859 HandleLaunchAppN(2);
860 break;
861 case LAUNCH_APP_3:
862 HandleLaunchAppN(3);
863 break;
864 case LAUNCH_APP_4:
865 HandleLaunchAppN(4);
866 break;
867 case LAUNCH_APP_5:
868 HandleLaunchAppN(5);
869 break;
870 case LAUNCH_APP_6:
871 HandleLaunchAppN(6);
872 break;
873 case LAUNCH_APP_7:
874 HandleLaunchAppN(7);
875 break;
876 case LAUNCH_LAST_APP:
877 HandleLaunchLastApp();
878 break;
821 case MEDIA_NEXT_TRACK: 879 case MEDIA_NEXT_TRACK:
822 HandleMediaNextTrack(); 880 HandleMediaNextTrack();
823 break; 881 break;
824 case MEDIA_PLAY_PAUSE: 882 case MEDIA_PLAY_PAUSE:
825 HandleMediaPlayPause(); 883 HandleMediaPlayPause();
826 break; 884 break;
827 case MEDIA_PREV_TRACK: 885 case MEDIA_PREV_TRACK:
828 HandleMediaPrevTrack(); 886 HandleMediaPrevTrack();
829 break; 887 break;
830 case NEW_INCOGNITO_WINDOW: 888 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() && 1078 if (wm_shell->mru_window_tracker()->BuildMruWindowList().empty() &&
1021 actions_needing_window_.find(action) != actions_needing_window_.end()) { 1079 actions_needing_window_.find(action) != actions_needing_window_.end()) {
1022 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert( 1080 wm_shell->accessibility_delegate()->TriggerAccessibilityAlert(
1023 A11Y_ALERT_WINDOW_NEEDED); 1081 A11Y_ALERT_WINDOW_NEEDED);
1024 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION; 1082 return RESTRICTION_PREVENT_PROCESSING_AND_PROPAGATION;
1025 } 1083 }
1026 return RESTRICTION_NONE; 1084 return RESTRICTION_NONE;
1027 } 1085 }
1028 1086
1029 } // namespace ash 1087 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698