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