| 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/common/accelerators/accelerator_controller.h" | 5 #include "ash/common/accelerators/accelerator_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_commands.h" | 9 #include "ash/common/accelerators/accelerator_commands.h" |
| 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" | 10 #include "ash/common/accelerators/accelerator_controller_delegate.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE. | 192 // TODO(stevet): Not sure if this is the same as IDC_FOCUS_NEXT_PANE. |
| 193 case FocusCycler::FORWARD: { | 193 case FocusCycler::FORWARD: { |
| 194 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane")); | 194 base::RecordAction(UserMetricsAction("Accel_Focus_Next_Pane")); |
| 195 break; | 195 break; |
| 196 } | 196 } |
| 197 case FocusCycler::BACKWARD: { | 197 case FocusCycler::BACKWARD: { |
| 198 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); | 198 base::RecordAction(UserMetricsAction("Accel_Focus_Previous_Pane")); |
| 199 break; | 199 break; |
| 200 } | 200 } |
| 201 } | 201 } |
| 202 WmShell::Get()->focus_cycler()->RotateFocus(direction); | 202 Shell::Get()->focus_cycler()->RotateFocus(direction); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void HandleFocusShelf() { | 205 void HandleFocusShelf() { |
| 206 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); | 206 base::RecordAction(UserMetricsAction("Accel_Focus_Shelf")); |
| 207 // TODO(jamescook): Should this be GetWmRootWindowForNewWindows()? | 207 // TODO(jamescook): Should this be GetWmRootWindowForNewWindows()? |
| 208 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); | 208 WmShelf* shelf = WmShelf::ForWindow(WmShell::Get()->GetPrimaryRootWindow()); |
| 209 WmShell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); | 209 Shell::Get()->focus_cycler()->FocusWidget(shelf->shelf_widget()); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void HandleLaunchAppN(int n) { | 212 void HandleLaunchAppN(int n) { |
| 213 base::RecordAction(UserMetricsAction("Accel_Launch_App")); | 213 base::RecordAction(UserMetricsAction("Accel_Launch_App")); |
| 214 WmShelf::LaunchShelfItem(n); | 214 WmShelf::LaunchShelfItem(n); |
| 215 } | 215 } |
| 216 | 216 |
| 217 void HandleLaunchLastApp() { | 217 void HandleLaunchLastApp() { |
| 218 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); | 218 base::RecordAction(UserMetricsAction("Accel_Launch_Last_App")); |
| 219 WmShelf::LaunchShelfItem(-1); | 219 WmShelf::LaunchShelfItem(-1); |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 GetAcceleratorProcessingRestriction(action); | 990 GetAcceleratorProcessingRestriction(action); |
| 991 if (restriction != RESTRICTION_NONE) | 991 if (restriction != RESTRICTION_NONE) |
| 992 return; | 992 return; |
| 993 | 993 |
| 994 // If your accelerator invokes more than one line of code, please either | 994 // If your accelerator invokes more than one line of code, please either |
| 995 // implement it in your module's controller code or pull it into a HandleFoo() | 995 // implement it in your module's controller code or pull it into a HandleFoo() |
| 996 // function above. | 996 // function above. |
| 997 switch (action) { | 997 switch (action) { |
| 998 case BRIGHTNESS_DOWN: { | 998 case BRIGHTNESS_DOWN: { |
| 999 BrightnessControlDelegate* delegate = | 999 BrightnessControlDelegate* delegate = |
| 1000 WmShell::Get()->brightness_control_delegate(); | 1000 Shell::Get()->brightness_control_delegate(); |
| 1001 if (delegate) | 1001 if (delegate) |
| 1002 delegate->HandleBrightnessDown(accelerator); | 1002 delegate->HandleBrightnessDown(accelerator); |
| 1003 break; | 1003 break; |
| 1004 } | 1004 } |
| 1005 case BRIGHTNESS_UP: { | 1005 case BRIGHTNESS_UP: { |
| 1006 BrightnessControlDelegate* delegate = | 1006 BrightnessControlDelegate* delegate = |
| 1007 WmShell::Get()->brightness_control_delegate(); | 1007 Shell::Get()->brightness_control_delegate(); |
| 1008 if (delegate) | 1008 if (delegate) |
| 1009 delegate->HandleBrightnessUp(accelerator); | 1009 delegate->HandleBrightnessUp(accelerator); |
| 1010 break; | 1010 break; |
| 1011 } | 1011 } |
| 1012 case CYCLE_BACKWARD_MRU: | 1012 case CYCLE_BACKWARD_MRU: |
| 1013 HandleCycleBackwardMRU(accelerator); | 1013 HandleCycleBackwardMRU(accelerator); |
| 1014 break; | 1014 break; |
| 1015 case CYCLE_FORWARD_MRU: | 1015 case CYCLE_FORWARD_MRU: |
| 1016 HandleCycleForwardMRU(accelerator); | 1016 HandleCycleForwardMRU(accelerator); |
| 1017 break; | 1017 break; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1037 HandleRotatePaneFocus(FocusCycler::FORWARD); | 1037 HandleRotatePaneFocus(FocusCycler::FORWARD); |
| 1038 break; | 1038 break; |
| 1039 case FOCUS_PREVIOUS_PANE: | 1039 case FOCUS_PREVIOUS_PANE: |
| 1040 HandleRotatePaneFocus(FocusCycler::BACKWARD); | 1040 HandleRotatePaneFocus(FocusCycler::BACKWARD); |
| 1041 break; | 1041 break; |
| 1042 case FOCUS_SHELF: | 1042 case FOCUS_SHELF: |
| 1043 HandleFocusShelf(); | 1043 HandleFocusShelf(); |
| 1044 break; | 1044 break; |
| 1045 case KEYBOARD_BRIGHTNESS_DOWN: { | 1045 case KEYBOARD_BRIGHTNESS_DOWN: { |
| 1046 KeyboardBrightnessControlDelegate* delegate = | 1046 KeyboardBrightnessControlDelegate* delegate = |
| 1047 WmShell::Get()->keyboard_brightness_control_delegate(); | 1047 Shell::Get()->keyboard_brightness_control_delegate(); |
| 1048 if (delegate) | 1048 if (delegate) |
| 1049 delegate->HandleKeyboardBrightnessDown(accelerator); | 1049 delegate->HandleKeyboardBrightnessDown(accelerator); |
| 1050 break; | 1050 break; |
| 1051 } | 1051 } |
| 1052 case KEYBOARD_BRIGHTNESS_UP: { | 1052 case KEYBOARD_BRIGHTNESS_UP: { |
| 1053 KeyboardBrightnessControlDelegate* delegate = | 1053 KeyboardBrightnessControlDelegate* delegate = |
| 1054 WmShell::Get()->keyboard_brightness_control_delegate(); | 1054 Shell::Get()->keyboard_brightness_control_delegate(); |
| 1055 if (delegate) | 1055 if (delegate) |
| 1056 delegate->HandleKeyboardBrightnessUp(accelerator); | 1056 delegate->HandleKeyboardBrightnessUp(accelerator); |
| 1057 break; | 1057 break; |
| 1058 } | 1058 } |
| 1059 case LAUNCH_APP_0: | 1059 case LAUNCH_APP_0: |
| 1060 HandleLaunchAppN(0); | 1060 HandleLaunchAppN(0); |
| 1061 break; | 1061 break; |
| 1062 case LAUNCH_APP_1: | 1062 case LAUNCH_APP_1: |
| 1063 HandleLaunchAppN(1); | 1063 HandleLaunchAppN(1); |
| 1064 break; | 1064 break; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1292 data->uma_histogram_name, data->notification_message_id, | 1292 data->uma_histogram_name, data->notification_message_id, |
| 1293 data->old_shortcut_id, data->new_shortcut_id); | 1293 data->old_shortcut_id, data->new_shortcut_id); |
| 1294 | 1294 |
| 1295 if (!data->deprecated_enabled) | 1295 if (!data->deprecated_enabled) |
| 1296 return AcceleratorProcessingStatus::STOP; | 1296 return AcceleratorProcessingStatus::STOP; |
| 1297 | 1297 |
| 1298 return AcceleratorProcessingStatus::PROCEED; | 1298 return AcceleratorProcessingStatus::PROCEED; |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 } // namespace ash | 1301 } // namespace ash |
| OLD | NEW |