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 <iostream> | 9 #include <iostream> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "ash/accelerators/accelerator_commands.h" | 12 #include "ash/accelerators/accelerator_commands.h" |
13 #include "ash/accelerators/accelerator_table.h" | 13 #include "ash/accelerators/accelerator_table.h" |
14 #include "ash/accelerators/debug_commands.h" | 14 #include "ash/accelerators/debug_commands.h" |
15 #include "ash/ash_switches.h" | 15 #include "ash/ash_switches.h" |
16 #include "ash/caps_lock_delegate.h" | 16 #include "ash/caps_lock_delegate.h" |
17 #include "ash/debug.h" | 17 #include "ash/debug.h" |
18 #include "ash/display/display_controller.h" | 18 #include "ash/display/display_controller.h" |
19 #include "ash/display/display_manager.h" | 19 #include "ash/display/display_manager.h" |
20 #include "ash/focus_cycler.h" | 20 #include "ash/focus_cycler.h" |
21 #include "ash/ime_control_delegate.h" | 21 #include "ash/ime_control_delegate.h" |
22 #include "ash/launcher/launcher.h" | |
23 #include "ash/magnifier/magnification_controller.h" | 22 #include "ash/magnifier/magnification_controller.h" |
24 #include "ash/magnifier/partial_magnification_controller.h" | 23 #include "ash/magnifier/partial_magnification_controller.h" |
25 #include "ash/media_delegate.h" | 24 #include "ash/media_delegate.h" |
26 #include "ash/multi_profile_uma.h" | 25 #include "ash/multi_profile_uma.h" |
27 #include "ash/new_window_delegate.h" | 26 #include "ash/new_window_delegate.h" |
28 #include "ash/root_window_controller.h" | 27 #include "ash/root_window_controller.h" |
29 #include "ash/rotator/screen_rotation.h" | 28 #include "ash/rotator/screen_rotation.h" |
30 #include "ash/screenshot_delegate.h" | 29 #include "ash/screenshot_delegate.h" |
31 #include "ash/session_state_delegate.h" | 30 #include "ash/session_state_delegate.h" |
| 31 #include "ash/shelf/shelf.h" |
32 #include "ash/shelf/shelf_delegate.h" | 32 #include "ash/shelf/shelf_delegate.h" |
33 #include "ash/shelf/shelf_model.h" | 33 #include "ash/shelf/shelf_model.h" |
34 #include "ash/shelf/shelf_widget.h" | 34 #include "ash/shelf/shelf_widget.h" |
35 #include "ash/shell.h" | 35 #include "ash/shell.h" |
36 #include "ash/shell_delegate.h" | 36 #include "ash/shell_delegate.h" |
37 #include "ash/shell_window_ids.h" | 37 #include "ash/shell_window_ids.h" |
38 #include "ash/system/brightness_control_delegate.h" | 38 #include "ash/system/brightness_control_delegate.h" |
39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 39 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
40 #include "ash/system/status_area_widget.h" | 40 #include "ash/system/status_area_widget.h" |
41 #include "ash/system/tray/system_tray.h" | 41 #include "ash/system/tray/system_tray.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 shell->caps_lock_delegate()->SetCapsLockEnabled(false); | 190 shell->caps_lock_delegate()->SetCapsLockEnabled(false); |
191 return true; | 191 return true; |
192 } | 192 } |
193 return false; | 193 return false; |
194 } | 194 } |
195 | 195 |
196 bool HandleFocusLauncher() { | 196 bool HandleFocusLauncher() { |
197 Shell* shell = Shell::GetInstance(); | 197 Shell* shell = Shell::GetInstance(); |
198 content::RecordAction(content::UserMetricsAction("Accel_Focus_Launcher")); | 198 content::RecordAction(content::UserMetricsAction("Accel_Focus_Launcher")); |
199 return shell->focus_cycler()->FocusWidget( | 199 return shell->focus_cycler()->FocusWidget( |
200 Launcher::ForPrimaryDisplay()->shelf_widget()); | 200 Shelf::ForPrimaryDisplay()->shelf_widget()); |
201 } | 201 } |
202 | 202 |
203 bool HandleLaunchAppN(int n) { | 203 bool HandleLaunchAppN(int n) { |
204 content::RecordAction(UserMetricsAction("Accel_Launch_App")); | 204 content::RecordAction(UserMetricsAction("Accel_Launch_App")); |
205 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(n); | 205 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(n); |
206 return true; | 206 return true; |
207 } | 207 } |
208 | 208 |
209 bool HandleLaunchLastApp() { | 209 bool HandleLaunchLastApp() { |
210 content::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); | 210 content::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); |
211 Launcher::ForPrimaryDisplay()->LaunchAppIndexAt(-1); | 211 Shelf::ForPrimaryDisplay()->LaunchAppIndexAt(-1); |
212 return true; | 212 return true; |
213 } | 213 } |
214 | 214 |
215 // Magnify the screen | 215 // Magnify the screen |
216 bool HandleMagnifyScreen(int delta_index) { | 216 bool HandleMagnifyScreen(int delta_index) { |
217 if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) { | 217 if (ash::Shell::GetInstance()->magnification_controller()->IsEnabled()) { |
218 // TODO(yoshiki): Move the following logic to MagnificationController. | 218 // TODO(yoshiki): Move the following logic to MagnificationController. |
219 float scale = | 219 float scale = |
220 ash::Shell::GetInstance()->magnification_controller()->GetScale(); | 220 ash::Shell::GetInstance()->magnification_controller()->GetScale(); |
221 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. | 221 // Calculate rounded logarithm (base kMagnificationScaleFactor) of scale. |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 keyboard_brightness_control_delegate) { | 1206 keyboard_brightness_control_delegate) { |
1207 keyboard_brightness_control_delegate_ = | 1207 keyboard_brightness_control_delegate_ = |
1208 keyboard_brightness_control_delegate.Pass(); | 1208 keyboard_brightness_control_delegate.Pass(); |
1209 } | 1209 } |
1210 | 1210 |
1211 bool AcceleratorController::CanHandleAccelerators() const { | 1211 bool AcceleratorController::CanHandleAccelerators() const { |
1212 return true; | 1212 return true; |
1213 } | 1213 } |
1214 | 1214 |
1215 } // namespace ash | 1215 } // namespace ash |
OLD | NEW |