| OLD | NEW |
| 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 Loading... |
| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: | 1139 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: |
| 1143 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: | 1140 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: |
| 1144 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: | 1141 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: |
| 1145 debug::PerformDebugActionIfEnabled(action); | 1142 debug::PerformDebugActionIfEnabled(action); |
| 1146 break; | 1143 break; |
| 1147 case EXIT: | 1144 case EXIT: |
| 1148 // UMA metrics are recorded in the handler. | 1145 // UMA metrics are recorded in the handler. |
| 1149 exit_warning_handler_.HandleAccelerator(); | 1146 exit_warning_handler_.HandleAccelerator(); |
| 1150 break; | 1147 break; |
| 1151 case FOCUS_NEXT_PANE: | 1148 case FOCUS_NEXT_PANE: |
| 1152 HandleRotatePaneFocus(Shell::FORWARD); | 1149 HandleRotatePaneFocus(FocusCycler::FORWARD); |
| 1153 break; | 1150 break; |
| 1154 case FOCUS_PREVIOUS_PANE: | 1151 case FOCUS_PREVIOUS_PANE: |
| 1155 HandleRotatePaneFocus(Shell::BACKWARD); | 1152 HandleRotatePaneFocus(FocusCycler::BACKWARD); |
| 1156 break; | 1153 break; |
| 1157 case FOCUS_SHELF: | 1154 case FOCUS_SHELF: |
| 1158 HandleFocusShelf(); | 1155 HandleFocusShelf(); |
| 1159 break; | 1156 break; |
| 1160 case LAUNCH_APP_0: | 1157 case LAUNCH_APP_0: |
| 1161 HandleLaunchAppN(0); | 1158 HandleLaunchAppN(0); |
| 1162 break; | 1159 break; |
| 1163 case LAUNCH_APP_1: | 1160 case LAUNCH_APP_1: |
| 1164 HandleLaunchAppN(1); | 1161 HandleLaunchAppN(1); |
| 1165 break; | 1162 break; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1437 } | 1434 } |
| 1438 | 1435 |
| 1439 void AcceleratorController::SetKeyboardBrightnessControlDelegate( | 1436 void AcceleratorController::SetKeyboardBrightnessControlDelegate( |
| 1440 std::unique_ptr<KeyboardBrightnessControlDelegate> | 1437 std::unique_ptr<KeyboardBrightnessControlDelegate> |
| 1441 keyboard_brightness_control_delegate) { | 1438 keyboard_brightness_control_delegate) { |
| 1442 keyboard_brightness_control_delegate_ = | 1439 keyboard_brightness_control_delegate_ = |
| 1443 std::move(keyboard_brightness_control_delegate); | 1440 std::move(keyboard_brightness_control_delegate); |
| 1444 } | 1441 } |
| 1445 | 1442 |
| 1446 } // namespace ash | 1443 } // namespace ash |
| OLD | NEW |