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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); | 362 actions_allowed_at_modal_window_.insert(kActionsAllowedAtModalWindow[i]); |
362 for (size_t i = 0; i < kReservedActionsLength; ++i) | 363 for (size_t i = 0; i < kReservedActionsLength; ++i) |
363 reserved_actions_.insert(kReservedActions[i]); | 364 reserved_actions_.insert(kReservedActions[i]); |
364 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) | 365 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) |
365 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); | 366 nonrepeatable_actions_.insert(kNonrepeatableActions[i]); |
366 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) | 367 for (size_t i = 0; i < kActionsAllowedInAppModeLength; ++i) |
367 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); | 368 actions_allowed_in_app_mode_.insert(kActionsAllowedInAppMode[i]); |
368 | 369 |
369 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); | 370 RegisterAccelerators(kAcceleratorData, kAcceleratorDataLength); |
370 | 371 |
| 372 #if !defined(NDEBUG) |
| 373 RegisterAccelerators(kDesktopAcceleratorData, kDesktopAcceleratorDataLength); |
| 374 #endif |
| 375 |
371 if (DebugShortcutsEnabled()) | 376 if (DebugShortcutsEnabled()) |
372 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); | 377 RegisterAccelerators(kDebugAcceleratorData, kDebugAcceleratorDataLength); |
373 | 378 |
374 #if defined(OS_CHROMEOS) | 379 #if defined(OS_CHROMEOS) |
375 keyboard_brightness_control_delegate_.reset( | 380 keyboard_brightness_control_delegate_.reset( |
376 new KeyboardBrightnessController()); | 381 new KeyboardBrightnessController()); |
377 #endif | 382 #endif |
378 } | 383 } |
379 | 384 |
380 void AcceleratorController::Register(const ui::Accelerator& accelerator, | 385 void AcceleratorController::Register(const ui::Accelerator& accelerator, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 case SCALE_UI_RESET: | 806 case SCALE_UI_RESET: |
802 return HandleScaleReset(); | 807 return HandleScaleReset(); |
803 case ROTATE_WINDOW: | 808 case ROTATE_WINDOW: |
804 return HandleRotateActiveWindow(); | 809 return HandleRotateActiveWindow(); |
805 case ROTATE_SCREEN: | 810 case ROTATE_SCREEN: |
806 return HandleRotateScreen(); | 811 return HandleRotateScreen(); |
807 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 812 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
808 return HandleToggleDesktopBackgroundMode(); | 813 return HandleToggleDesktopBackgroundMode(); |
809 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 814 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
810 return HandleToggleRootWindowFullScreen(); | 815 return HandleToggleRootWindowFullScreen(); |
811 case DISPLAY_TOGGLE_SCALE: | 816 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: |
812 internal::DisplayManager::ToggleDisplayScaleFactor(); | 817 internal::DisplayManager::ToggleDisplayScaleFactor(); |
813 return true; | 818 return true; |
| 819 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: |
| 820 ash::debug::ToggleShowPaintRects(); |
| 821 return true; |
814 case MAGNIFY_SCREEN_ZOOM_IN: | 822 case MAGNIFY_SCREEN_ZOOM_IN: |
815 return HandleMagnifyScreen(1); | 823 return HandleMagnifyScreen(1); |
816 case MAGNIFY_SCREEN_ZOOM_OUT: | 824 case MAGNIFY_SCREEN_ZOOM_OUT: |
817 return HandleMagnifyScreen(-1); | 825 return HandleMagnifyScreen(-1); |
818 case MEDIA_NEXT_TRACK: | 826 case MEDIA_NEXT_TRACK: |
819 return HandleMediaNextTrack(); | 827 return HandleMediaNextTrack(); |
820 case MEDIA_PLAY_PAUSE: | 828 case MEDIA_PLAY_PAUSE: |
821 return HandleMediaPlayPause(); | 829 return HandleMediaPlayPause(); |
822 case MEDIA_PREV_TRACK: | 830 case MEDIA_PREV_TRACK: |
823 return HandleMediaPrevTrack(); | 831 return HandleMediaPrevTrack(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 keyboard_brightness_control_delegate) { | 914 keyboard_brightness_control_delegate) { |
907 keyboard_brightness_control_delegate_ = | 915 keyboard_brightness_control_delegate_ = |
908 keyboard_brightness_control_delegate.Pass(); | 916 keyboard_brightness_control_delegate.Pass(); |
909 } | 917 } |
910 | 918 |
911 bool AcceleratorController::CanHandleAccelerators() const { | 919 bool AcceleratorController::CanHandleAccelerators() const { |
912 return true; | 920 return true; |
913 } | 921 } |
914 | 922 |
915 } // namespace ash | 923 } // namespace ash |
OLD | NEW |