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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/accelerators/accelerator_table.h" | 9 #include "ash/accelerators/accelerator_table.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/caps_lock_delegate.h" | 11 #include "ash/caps_lock_delegate.h" |
12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
13 #include "ash/focus_cycler.h" | 13 #include "ash/focus_cycler.h" |
14 #include "ash/ime_control_delegate.h" | 14 #include "ash/ime_control_delegate.h" |
15 #include "ash/launcher/launcher.h" | 15 #include "ash/launcher/launcher.h" |
16 #include "ash/launcher/launcher_delegate.h" | 16 #include "ash/launcher/launcher_delegate.h" |
17 #include "ash/launcher/launcher_model.h" | 17 #include "ash/launcher/launcher_model.h" |
18 #include "ash/magnifier/magnification_controller.h" | 18 #include "ash/magnifier/magnification_controller.h" |
19 #include "ash/monitor/monitor_controller.h" | 19 #include "ash/display/display_controller.h" |
20 #include "ash/monitor/multi_monitor_manager.h" | 20 #include "ash/display/multi_display_manager.h" |
21 #include "ash/root_window_controller.h" | 21 #include "ash/root_window_controller.h" |
22 #include "ash/screenshot_delegate.h" | 22 #include "ash/screenshot_delegate.h" |
23 #include "ash/shell.h" | 23 #include "ash/shell.h" |
24 #include "ash/shell_delegate.h" | 24 #include "ash/shell_delegate.h" |
25 #include "ash/shell_window_ids.h" | 25 #include "ash/shell_window_ids.h" |
26 #include "ash/system/brightness/brightness_control_delegate.h" | 26 #include "ash/system/brightness/brightness_control_delegate.h" |
27 #include "ash/system/tray/system_tray.h" | 27 #include "ash/system/tray/system_tray.h" |
28 #include "ash/volume_control_delegate.h" | 28 #include "ash/volume_control_delegate.h" |
29 #include "ash/wm/property_util.h" | 29 #include "ash/wm/property_util.h" |
30 #include "ash/wm/window_cycle_controller.h" | 30 #include "ash/wm/window_cycle_controller.h" |
31 #include "ash/wm/window_util.h" | 31 #include "ash/wm/window_util.h" |
32 #include "ash/wm/workspace/snap_sizer.h" | 32 #include "ash/wm/workspace/snap_sizer.h" |
33 #include "base/command_line.h" | 33 #include "base/command_line.h" |
34 #include "ui/aura/event.h" | 34 #include "ui/aura/event.h" |
35 #include "ui/aura/root_window.h" | 35 #include "ui/aura/root_window.h" |
36 #include "ui/base/accelerators/accelerator.h" | 36 #include "ui/base/accelerators/accelerator.h" |
37 #include "ui/base/accelerators/accelerator_manager.h" | 37 #include "ui/base/accelerators/accelerator_manager.h" |
38 #include "ui/base/keycodes/keyboard_codes.h" | 38 #include "ui/base/keycodes/keyboard_codes.h" |
39 #include "ui/compositor/debug_utils.h" | 39 #include "ui/compositor/debug_utils.h" |
40 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
41 #include "ui/compositor/layer_animation_sequence.h" | 41 #include "ui/compositor/layer_animation_sequence.h" |
42 #include "ui/compositor/layer_animator.h" | 42 #include "ui/compositor/layer_animator.h" |
43 #include "ui/compositor/screen_rotation.h" | 43 #include "ui/compositor/screen_rotation.h" |
44 #include "ui/oak/oak.h" | 44 #include "ui/oak/oak.h" |
45 | 45 |
46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
47 #include "chromeos/monitor/output_configurator.h" | 47 #include "chromeos/display/output_configurator.h" |
48 #endif // defined(OS_CHROMEOS) | 48 #endif // defined(OS_CHROMEOS) |
49 | 49 |
50 namespace ash { | 50 namespace ash { |
51 namespace { | 51 namespace { |
52 | 52 |
53 // Factor of magnification scale. For example, when this value is 1.189, scale | 53 // Factor of magnification scale. For example, when this value is 1.189, scale |
54 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... | 54 // value will be changed x1.000, x1.189, x1.414, x1.681, x2.000, ... |
55 // Note: this value is 2.0 ^ (1 / 4). | 55 // Note: this value is 2.0 ^ (1 / 4). |
56 const float kMagnificationFactor = 1.18920712f; | 56 const float kMagnificationFactor = 1.18920712f; |
57 | 57 |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 break; | 578 break; |
579 } | 579 } |
580 case ROTATE_WINDOWS: | 580 case ROTATE_WINDOWS: |
581 return HandleRotateWindows(); | 581 return HandleRotateWindows(); |
582 case ROTATE_SCREEN: | 582 case ROTATE_SCREEN: |
583 return HandleRotateScreen(); | 583 return HandleRotateScreen(); |
584 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 584 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
585 return HandleToggleDesktopBackgroundMode(); | 585 return HandleToggleDesktopBackgroundMode(); |
586 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 586 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
587 return HandleToggleRootWindowFullScreen(); | 587 return HandleToggleRootWindowFullScreen(); |
588 case MONITOR_ADD_REMOVE: | 588 case DISPLAY_ADD_REMOVE: |
589 if (DebugShortcutsEnabled()) | 589 if (DebugShortcutsEnabled()) |
590 internal::MultiMonitorManager::AddRemoveMonitor(); | 590 internal::MultiDisplayManager::AddRemoveDisplay(); |
591 return true; | 591 return true; |
592 case MONITOR_CYCLE: | 592 case DISPLAY_CYCLE: |
593 if (DebugShortcutsEnabled()) | 593 if (DebugShortcutsEnabled()) |
594 internal::MultiMonitorManager::CycleMonitor(); | 594 internal::MultiDisplayManager::CycleDisplay(); |
595 return true; | 595 return true; |
596 case MONITOR_TOGGLE_SCALE: | 596 case DISPLAY_TOGGLE_SCALE: |
597 if (DebugShortcutsEnabled()) | 597 if (DebugShortcutsEnabled()) |
598 internal::MultiMonitorManager::ToggleMonitorScale(); | 598 internal::MultiDisplayManager::ToggleDisplayScale(); |
599 return true; | 599 return true; |
600 case MAGNIFY_SCREEN_ZOOM_IN: | 600 case MAGNIFY_SCREEN_ZOOM_IN: |
601 return HandleMagnifyScreen(1); | 601 return HandleMagnifyScreen(1); |
602 case MAGNIFY_SCREEN_ZOOM_OUT: | 602 case MAGNIFY_SCREEN_ZOOM_OUT: |
603 return HandleMagnifyScreen(-1); | 603 return HandleMagnifyScreen(-1); |
604 #if !defined(NDEBUG) | 604 #if !defined(NDEBUG) |
605 case PRINT_LAYER_HIERARCHY: | 605 case PRINT_LAYER_HIERARCHY: |
606 return HandlePrintLayerHierarchy(); | 606 return HandlePrintLayerHierarchy(); |
607 case PRINT_WINDOW_HIERARCHY: | 607 case PRINT_WINDOW_HIERARCHY: |
608 return HandlePrintWindowHierarchy(); | 608 return HandlePrintWindowHierarchy(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // Then set this one as active. | 675 // Then set this one as active. |
676 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); | 676 Shell::GetInstance()->launcher()->ActivateLauncherItem(found_index); |
677 } | 677 } |
678 } | 678 } |
679 | 679 |
680 bool AcceleratorController::CanHandleAccelerators() const { | 680 bool AcceleratorController::CanHandleAccelerators() const { |
681 return true; | 681 return true; |
682 } | 682 } |
683 | 683 |
684 } // namespace ash | 684 } // namespace ash |
OLD | NEW |