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

Side by Side Diff: ash/accelerators/accelerator_controller.cc

Issue 2075923002: mash: Convert FocusCycler to wm common types and move to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 6 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 | « no previous file | ash/ash.gyp » ('j') | ash/aura/wm_window_aura.cc » ('J')
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/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "ash/accelerators/accelerator_commands.h" 12 #include "ash/accelerators/accelerator_commands.h"
13 #include "ash/accelerators/debug_commands.h" 13 #include "ash/accelerators/debug_commands.h"
14 #include "ash/ash_switches.h" 14 #include "ash/ash_switches.h"
15 #include "ash/common/focus_cycler.h"
15 #include "ash/common/session/session_state_delegate.h" 16 #include "ash/common/session/session_state_delegate.h"
16 #include "ash/common/shelf/shelf_model.h" 17 #include "ash/common/shelf/shelf_model.h"
17 #include "ash/common/shell_window_ids.h" 18 #include "ash/common/shell_window_ids.h"
18 #include "ash/common/system/tray/system_tray_delegate.h" 19 #include "ash/common/system/tray/system_tray_delegate.h"
19 #include "ash/common/system/volume_control_delegate.h" 20 #include "ash/common/system/volume_control_delegate.h"
20 #include "ash/common/wm/mru_window_tracker.h" 21 #include "ash/common/wm/mru_window_tracker.h"
21 #include "ash/common/wm/window_state.h" 22 #include "ash/common/wm/window_state.h"
22 #include "ash/common/wm/wm_event.h" 23 #include "ash/common/wm/wm_event.h"
23 #include "ash/common/wm_shell.h" 24 #include "ash/common/wm_shell.h"
24 #include "ash/debug.h" 25 #include "ash/debug.h"
25 #include "ash/display/window_tree_host_manager.h" 26 #include "ash/display/window_tree_host_manager.h"
26 #include "ash/focus_cycler.h"
27 #include "ash/gpu_support.h" 27 #include "ash/gpu_support.h"
28 #include "ash/ime_control_delegate.h" 28 #include "ash/ime_control_delegate.h"
29 #include "ash/magnifier/magnification_controller.h" 29 #include "ash/magnifier/magnification_controller.h"
30 #include "ash/magnifier/partial_magnification_controller.h" 30 #include "ash/magnifier/partial_magnification_controller.h"
31 #include "ash/media_delegate.h" 31 #include "ash/media_delegate.h"
32 #include "ash/multi_profile_uma.h" 32 #include "ash/multi_profile_uma.h"
33 #include "ash/new_window_delegate.h" 33 #include "ash/new_window_delegate.h"
34 #include "ash/root_window_controller.h" 34 #include "ash/root_window_controller.h"
35 #include "ash/rotator/screen_rotation_animator.h" 35 #include "ash/rotator/screen_rotation_animator.h"
36 #include "ash/rotator/window_rotation.h" 36 #include "ash/rotator/window_rotation.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void HandleCycleForwardMRU(const ui::Accelerator& accelerator) { 199 void HandleCycleForwardMRU(const ui::Accelerator& accelerator) {
200 if (accelerator.key_code() == ui::VKEY_TAB) 200 if (accelerator.key_code() == ui::VKEY_TAB)
201 base::RecordAction(base::UserMetricsAction("Accel_NextWindow_Tab")); 201 base::RecordAction(base::UserMetricsAction("Accel_NextWindow_Tab"));
202 202
203 Shell::GetInstance()->window_cycle_controller()->HandleCycleWindow( 203 Shell::GetInstance()->window_cycle_controller()->HandleCycleWindow(
204 WindowCycleController::FORWARD); 204 WindowCycleController::FORWARD);
205 } 205 }
206 206
207 void HandleRotatePaneFocus(Shell::Direction direction) { 207 void HandleRotatePaneFocus(FocusCycler::Direction direction) {
208 Shell* shell = Shell::GetInstance();
209 switch (direction) { 208 switch (direction) {
210 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE. 209 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE.
211 case Shell::FORWARD: { 210 case FocusCycler::FORWARD: {
212 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane")); 211 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane"));
213 shell->focus_cycler()->RotateFocus(FocusCycler::FORWARD);
214 break; 212 break;
215 } 213 }
216 case Shell::BACKWARD: { 214 case FocusCycler::BACKWARD: {
217 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); 215 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane"));
218 shell->focus_cycler()->RotateFocus(FocusCycler::BACKWARD);
219 break; 216 break;
220 } 217 }
221 } 218 }
219 WmShell::Get()->focus_cycler()->RotateFocus(direction);
222 } 220 }
223 221
224 void HandleFocusShelf() { 222 void HandleFocusShelf() {
225 Shell* shell = Shell::GetInstance();
226 base::RecordAction(base::UserMetricsAction("Accel_Focus_Shelf")); 223 base::RecordAction(base::UserMetricsAction("Accel_Focus_Shelf"));
227 shell->focus_cycler()->FocusWidget( 224 WmShell::Get()->focus_cycler()->FocusWidget(
228 Shelf::ForPrimaryDisplay()->shelf_widget()); 225 Shelf::ForPrimaryDisplay()->shelf_widget());
229 } 226 }
230 227
231 void HandleLaunchAppN(int n) { 228 void HandleLaunchAppN(int n) {
232 base::RecordAction(UserMetricsAction("Accel_Launch_App")); 229 base::RecordAction(UserMetricsAction("Accel_Launch_App"));
233 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n); 230 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n);
234 } 231 }
235 232
236 void HandleLaunchLastApp() { 233 void HandleLaunchLastApp() {
237 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); 234 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App"));
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 1153 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
1157 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 1154 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
1158 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 1155 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
1159 debug::PerformDebugActionIfEnabled(action); 1156 debug::PerformDebugActionIfEnabled(action);
1160 break; 1157 break;
1161 case EXIT: 1158 case EXIT:
1162 // UMA metrics are recorded in the handler. 1159 // UMA metrics are recorded in the handler.
1163 exit_warning_handler_.HandleAccelerator(); 1160 exit_warning_handler_.HandleAccelerator();
1164 break; 1161 break;
1165 case FOCUS_NEXT_PANE: 1162 case FOCUS_NEXT_PANE:
1166 HandleRotatePaneFocus(Shell::FORWARD); 1163 HandleRotatePaneFocus(FocusCycler::FORWARD);
1167 break; 1164 break;
1168 case FOCUS_PREVIOUS_PANE: 1165 case FOCUS_PREVIOUS_PANE:
1169 HandleRotatePaneFocus(Shell::BACKWARD); 1166 HandleRotatePaneFocus(FocusCycler::BACKWARD);
1170 break; 1167 break;
1171 case FOCUS_SHELF: 1168 case FOCUS_SHELF:
1172 HandleFocusShelf(); 1169 HandleFocusShelf();
1173 break; 1170 break;
1174 case LAUNCH_APP_0: 1171 case LAUNCH_APP_0:
1175 HandleLaunchAppN(0); 1172 HandleLaunchAppN(0);
1176 break; 1173 break;
1177 case LAUNCH_APP_1: 1174 case LAUNCH_APP_1:
1178 HandleLaunchAppN(1); 1175 HandleLaunchAppN(1);
1179 break; 1176 break;
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 } 1448 }
1452 1449
1453 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1450 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1454 std::unique_ptr<KeyboardBrightnessControlDelegate> 1451 std::unique_ptr<KeyboardBrightnessControlDelegate>
1455 keyboard_brightness_control_delegate) { 1452 keyboard_brightness_control_delegate) {
1456 keyboard_brightness_control_delegate_ = 1453 keyboard_brightness_control_delegate_ =
1457 std::move(keyboard_brightness_control_delegate); 1454 std::move(keyboard_brightness_control_delegate);
1458 } 1455 }
1459 1456
1460 } // namespace ash 1457 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/aura/wm_window_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698