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_table.h" | 12 #include "ash/accelerators/accelerator_table.h" |
13 #include "ash/ash_switches.h" | 13 #include "ash/ash_switches.h" |
14 #include "ash/caps_lock_delegate.h" | 14 #include "ash/caps_lock_delegate.h" |
| 15 #include "ash/debug.h" |
15 #include "ash/desktop_background/desktop_background_controller.h" | 16 #include "ash/desktop_background/desktop_background_controller.h" |
16 #include "ash/desktop_background/user_wallpaper_delegate.h" | 17 #include "ash/desktop_background/user_wallpaper_delegate.h" |
17 #include "ash/display/display_controller.h" | 18 #include "ash/display/display_controller.h" |
18 #include "ash/display/display_manager.h" | 19 #include "ash/display/display_manager.h" |
19 #include "ash/focus_cycler.h" | 20 #include "ash/focus_cycler.h" |
20 #include "ash/ime_control_delegate.h" | 21 #include "ash/ime_control_delegate.h" |
21 #include "ash/launcher/launcher.h" | 22 #include "ash/launcher/launcher.h" |
22 #include "ash/launcher/launcher_delegate.h" | 23 #include "ash/launcher/launcher_delegate.h" |
23 #include "ash/launcher/launcher_model.h" | 24 #include "ash/launcher/launcher_model.h" |
24 #include "ash/magnifier/magnification_controller.h" | 25 #include "ash/magnifier/magnification_controller.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); | 368 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); |
368 for (size_t i = 0; i < kReservedActionsLength; ++i) | 369 for (size_t i = 0; i < kReservedActionsLength; ++i) |
369 reserved_actions_.insert(kReservedActions[i]); | 370 reserved_actions_.insert(kReservedActions[i]); |
370 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) | 371 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) |
371 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); | 372 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); |
372 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) | 373 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) |
373 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); | 374 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); |
374 | 375 |
375 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); | 376 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); |
376 | 377 |
| 378 #if !defined(NDEBUG) |
| 379 RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength); |
| 380 #endif |
| 381 |
377 if (DebugShortcutsEnabled()) | 382 if (DebugShortcutsEnabled()) |
378 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); | 383 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); |
379 | 384 |
380 #if defined(OS_CHROMEOS) | 385 #if defined(OS_CHROMEOS) |
381 keyboard_brightness_control_delegate_.reset( | 386 keyboard_brightness_control_delegate_.reset( |
382 new KeyboardBrightnessController()); | 387 new KeyboardBrightnessController()); |
383 #endif | 388 #endif |
384 } | 389 } |
385 | 390 |
386 void AcceleratorController::Register(const ui::Accelerator& accelerator, | 391 void AcceleratorController::Register(const ui::Accelerator& accelerator, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 case SCALE_UI_RESET: | 812 case SCALE_UI_RESET: |
808 return HandleScaleReset(); | 813 return HandleScaleReset(); |
809 case ROTATE_WINDOW: | 814 case ROTATE_WINDOW: |
810 return HandleRotateActiveWindow(); | 815 return HandleRotateActiveWindow(); |
811 case ROTATE_SCREEN: | 816 case ROTATE_SCREEN: |
812 return HandleRotateScreen(); | 817 return HandleRotateScreen(); |
813 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 818 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
814 return HandleToggleDesktopBackgroundMode(); | 819 return HandleToggleDesktopBackgroundMode(); |
815 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 820 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
816 return HandleToggleRootWindowFullScreen(); | 821 return HandleToggleRootWindowFullScreen(); |
817 case DISPLAY_TOGGLE_SCALE: | 822 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: |
818 internal::DisplayManager::ToggleDisplayScaleFactor(); | 823 internal::DisplayManager::ToggleDisplayScaleFactor(); |
819 return true; | 824 return true; |
| 825 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: |
| 826 ash::debug::ToggleShowDebugBorders(); |
| 827 return true; |
| 828 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: |
| 829 ash::debug::ToggleShowFpsCounter(); |
| 830 return true; |
| 831 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: |
| 832 ash::debug::ToggleShowPaintRects(); |
| 833 return true; |
820 case MAGNIFY_SCREEN_ZOOM_IN: | 834 case MAGNIFY_SCREEN_ZOOM_IN: |
821 return HandleMagnifyScreen(1); | 835 return HandleMagnifyScreen(1); |
822 case MAGNIFY_SCREEN_ZOOM_OUT: | 836 case MAGNIFY_SCREEN_ZOOM_OUT: |
823 return HandleMagnifyScreen(-1); | 837 return HandleMagnifyScreen(-1); |
824 case MEDIA_NEXT_TRACK: | 838 case MEDIA_NEXT_TRACK: |
825 return HandleMediaNextTrack(); | 839 return HandleMediaNextTrack(); |
826 case MEDIA_PLAY_PAUSE: | 840 case MEDIA_PLAY_PAUSE: |
827 return HandleMediaPlayPause(); | 841 return HandleMediaPlayPause(); |
828 case MEDIA_PREV_TRACK: | 842 case MEDIA_PREV_TRACK: |
829 return HandleMediaPrevTrack(); | 843 return HandleMediaPrevTrack(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 keyboard_brightness_control_delegate) { | 926 keyboard_brightness_control_delegate) { |
913 keyboard_brightness_control_delegate_ = | 927 keyboard_brightness_control_delegate_ = |
914 keyboard_brightness_control_delegate.Pass(); | 928 keyboard_brightness_control_delegate.Pass(); |
915 } | 929 } |
916 | 930 |
917 bool AcceleratorController::CanHandleAccelerators() const { | 931 bool AcceleratorController::CanHandleAccelerators() const { |
918 return true; | 932 return true; |
919 } | 933 } |
920 | 934 |
921 } // namespace ash | 935 } // namespace ash |
OLD | NEW |