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 <string> | 9 #include <string> |
10 | 10 |
11 #include "ash/accelerators/accelerator_table.h" | 11 #include "ash/accelerators/accelerator_table.h" |
12 #include "ash/ash_switches.h" | 12 #include "ash/ash_switches.h" |
13 #include "ash/caps_lock_delegate.h" | 13 #include "ash/caps_lock_delegate.h" |
14 #include "ash/desktop_background/desktop_background_controller.h" | 14 #include "ash/desktop_background/desktop_background_controller.h" |
15 #include "ash/desktop_background/user_wallpaper_delegate.h" | 15 #include "ash/desktop_background/user_wallpaper_delegate.h" |
16 #include "ash/display/display_controller.h" | 16 #include "ash/display/display_controller.h" |
17 #include "ash/display/multi_display_manager.h" | 17 #include "ash/display/display_manager.h" |
18 #include "ash/focus_cycler.h" | 18 #include "ash/focus_cycler.h" |
19 #include "ash/ime_control_delegate.h" | 19 #include "ash/ime_control_delegate.h" |
20 #include "ash/launcher/launcher.h" | 20 #include "ash/launcher/launcher.h" |
21 #include "ash/launcher/launcher_delegate.h" | 21 #include "ash/launcher/launcher_delegate.h" |
22 #include "ash/launcher/launcher_model.h" | 22 #include "ash/launcher/launcher_model.h" |
23 #include "ash/magnifier/magnification_controller.h" | 23 #include "ash/magnifier/magnification_controller.h" |
24 #include "ash/root_window_controller.h" | 24 #include "ash/root_window_controller.h" |
25 #include "ash/rotator/screen_rotation.h" | 25 #include "ash/rotator/screen_rotation.h" |
26 #include "ash/screen_ash.h" | 26 #include "ash/screen_ash.h" |
27 #include "ash/screenshot_delegate.h" | 27 #include "ash/screenshot_delegate.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return true; | 110 return true; |
111 } | 111 } |
112 | 112 |
113 bool HandleToggleSpokenFeedback() { | 113 bool HandleToggleSpokenFeedback() { |
114 Shell::GetInstance()->delegate()->ToggleSpokenFeedback(); | 114 Shell::GetInstance()->delegate()->ToggleSpokenFeedback(); |
115 return true; | 115 return true; |
116 } | 116 } |
117 void HandleCycleDisplayMode() { | 117 void HandleCycleDisplayMode() { |
118 Shell* shell = Shell::GetInstance(); | 118 Shell* shell = Shell::GetInstance(); |
119 if (!base::chromeos::IsRunningOnChromeOS()) { | 119 if (!base::chromeos::IsRunningOnChromeOS()) { |
120 internal::MultiDisplayManager::CycleDisplay(); | 120 internal::DisplayManager::CycleDisplay(); |
121 } else if (shell->output_configurator()->connected_output_count() > 1) { | 121 } else if (shell->output_configurator()->connected_output_count() > 1) { |
122 internal::OutputConfiguratorAnimation* animation = | 122 internal::OutputConfiguratorAnimation* animation = |
123 shell->output_configurator_animation(); | 123 shell->output_configurator_animation(); |
124 animation->StartFadeOutAnimation(base::Bind( | 124 animation->StartFadeOutAnimation(base::Bind( |
125 base::IgnoreResult(&chromeos::OutputConfigurator::CycleDisplayMode), | 125 base::IgnoreResult(&chromeos::OutputConfigurator::CycleDisplayMode), |
126 base::Unretained(shell->output_configurator()))); | 126 base::Unretained(shell->output_configurator()))); |
127 } | 127 } |
128 } | 128 } |
129 | 129 |
130 void HandleSwapPrimaryDisplay() { | 130 void HandleSwapPrimaryDisplay() { |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 } | 732 } |
733 case ROTATE_WINDOWS: | 733 case ROTATE_WINDOWS: |
734 return HandleRotateWindows(); | 734 return HandleRotateWindows(); |
735 case ROTATE_SCREEN: | 735 case ROTATE_SCREEN: |
736 return HandleRotateScreen(); | 736 return HandleRotateScreen(); |
737 case TOGGLE_DESKTOP_BACKGROUND_MODE: | 737 case TOGGLE_DESKTOP_BACKGROUND_MODE: |
738 return HandleToggleDesktopBackgroundMode(); | 738 return HandleToggleDesktopBackgroundMode(); |
739 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: | 739 case TOGGLE_ROOT_WINDOW_FULL_SCREEN: |
740 return HandleToggleRootWindowFullScreen(); | 740 return HandleToggleRootWindowFullScreen(); |
741 case DISPLAY_TOGGLE_SCALE: | 741 case DISPLAY_TOGGLE_SCALE: |
742 internal::MultiDisplayManager::ToggleDisplayScale(); | 742 internal::DisplayManager::ToggleDisplayScale(); |
743 return true; | 743 return true; |
744 case MAGNIFY_SCREEN_ZOOM_IN: | 744 case MAGNIFY_SCREEN_ZOOM_IN: |
745 return HandleMagnifyScreen(1); | 745 return HandleMagnifyScreen(1); |
746 case MAGNIFY_SCREEN_ZOOM_OUT: | 746 case MAGNIFY_SCREEN_ZOOM_OUT: |
747 return HandleMagnifyScreen(-1); | 747 return HandleMagnifyScreen(-1); |
748 case MEDIA_NEXT_TRACK: | 748 case MEDIA_NEXT_TRACK: |
749 return HandleMediaNextTrack(); | 749 return HandleMediaNextTrack(); |
750 case MEDIA_PLAY_PAUSE: | 750 case MEDIA_PLAY_PAUSE: |
751 return HandleMediaPlayPause(); | 751 return HandleMediaPlayPause(); |
752 case MEDIA_PREV_TRACK: | 752 case MEDIA_PREV_TRACK: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 return HandlePrintWindowHierarchy(); | 791 return HandlePrintWindowHierarchy(); |
792 #endif | 792 #endif |
793 default: | 793 default: |
794 NOTREACHED() << "Unhandled action " << action; | 794 NOTREACHED() << "Unhandled action " << action; |
795 } | 795 } |
796 return false; | 796 return false; |
797 } | 797 } |
798 | 798 |
799 void AcceleratorController::SetBrightnessControlDelegate( | 799 void AcceleratorController::SetBrightnessControlDelegate( |
800 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { | 800 scoped_ptr<BrightnessControlDelegate> brightness_control_delegate) { |
801 internal::MultiDisplayManager* display_manager = | |
802 static_cast<internal::MultiDisplayManager*>( | |
803 aura::Env::GetInstance()->display_manager()); | |
804 // Install brightness control delegate only when internal | 801 // Install brightness control delegate only when internal |
805 // display exists. | 802 // display exists. |
806 if (display_manager->HasInternalDisplay()) | 803 if (Shell::GetInstance()->display_manager()->HasInternalDisplay()) |
807 brightness_control_delegate_.swap(brightness_control_delegate); | 804 brightness_control_delegate_.swap(brightness_control_delegate); |
808 } | 805 } |
809 | 806 |
810 void AcceleratorController::SetImeControlDelegate( | 807 void AcceleratorController::SetImeControlDelegate( |
811 scoped_ptr<ImeControlDelegate> ime_control_delegate) { | 808 scoped_ptr<ImeControlDelegate> ime_control_delegate) { |
812 ime_control_delegate_.swap(ime_control_delegate); | 809 ime_control_delegate_.swap(ime_control_delegate); |
813 } | 810 } |
814 | 811 |
815 void AcceleratorController::SetScreenshotDelegate( | 812 void AcceleratorController::SetScreenshotDelegate( |
816 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { | 813 scoped_ptr<ScreenshotDelegate> screenshot_delegate) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 keyboard_brightness_control_delegate) { | 872 keyboard_brightness_control_delegate) { |
876 keyboard_brightness_control_delegate_ = | 873 keyboard_brightness_control_delegate_ = |
877 keyboard_brightness_control_delegate.Pass(); | 874 keyboard_brightness_control_delegate.Pass(); |
878 } | 875 } |
879 | 876 |
880 bool AcceleratorController::CanHandleAccelerators() const { | 877 bool AcceleratorController::CanHandleAccelerators() const { |
881 return true; | 878 return true; |
882 } | 879 } |
883 | 880 |
884 } // namespace ash | 881 } // namespace ash |
OLD | NEW |