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/shell.h" | 5 #include "ash/shell.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/accelerators/accelerator_controller.h" | 10 #include "ash/accelerators/accelerator_controller.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 #include "ui/wm/core/focus_controller.h" | 106 #include "ui/wm/core/focus_controller.h" |
107 #include "ui/wm/core/input_method_event_filter.h" | 107 #include "ui/wm/core/input_method_event_filter.h" |
108 #include "ui/wm/core/shadow_controller.h" | 108 #include "ui/wm/core/shadow_controller.h" |
109 #include "ui/wm/core/visibility_controller.h" | 109 #include "ui/wm/core/visibility_controller.h" |
110 #include "ui/wm/core/window_modality_controller.h" | 110 #include "ui/wm/core/window_modality_controller.h" |
111 | 111 |
112 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
113 #if defined(USE_X11) | 113 #if defined(USE_X11) |
114 #include "ash/accelerators/magnifier_key_scroller.h" | 114 #include "ash/accelerators/magnifier_key_scroller.h" |
115 #include "ash/accelerators/spoken_feedback_toggler.h" | 115 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 116 #include "base/message_loop/message_pump_x11.h" |
| 117 #endif // defined(USE_X11) |
116 #include "ash/ash_constants.h" | 118 #include "ash/ash_constants.h" |
117 #include "ash/display/display_change_observer_chromeos.h" | 119 #include "ash/display/display_change_observer_chromeos.h" |
118 #include "ash/display/display_error_observer_chromeos.h" | 120 #include "ash/display/display_error_observer_chromeos.h" |
119 #include "ash/display/output_configurator_animation.h" | 121 #include "ash/display/output_configurator_animation.h" |
120 #include "ash/display/projecting_observer_chromeos.h" | 122 #include "ash/display/projecting_observer_chromeos.h" |
121 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" | |
122 #include "base/message_loop/message_pump_x11.h" | |
123 #include "base/sys_info.h" | |
124 #include "ui/display/chromeos/output_configurator.h" | |
125 #endif // defined(USE_X11) | |
126 #include "ash/display/resolution_notification_controller.h" | 123 #include "ash/display/resolution_notification_controller.h" |
127 #include "ash/sticky_keys/sticky_keys_controller.h" | 124 #include "ash/sticky_keys/sticky_keys_controller.h" |
128 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" | 125 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" |
129 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" | 126 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" |
130 #include "ash/system/chromeos/power/power_event_observer.h" | 127 #include "ash/system/chromeos/power/power_event_observer.h" |
131 #include "ash/system/chromeos/power/power_status.h" | 128 #include "ash/system/chromeos/power/power_status.h" |
132 #include "ash/system/chromeos/power/user_activity_notifier.h" | 129 #include "ash/system/chromeos/power/user_activity_notifier.h" |
133 #include "ash/system/chromeos/power/video_activity_notifier.h" | 130 #include "ash/system/chromeos/power/video_activity_notifier.h" |
| 131 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" |
134 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | 132 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
135 #include "base/bind_helpers.h" | 133 #include "base/bind_helpers.h" |
| 134 #include "base/sys_info.h" |
| 135 #include "ui/display/chromeos/output_configurator.h" |
136 #endif // defined(OS_CHROMEOS) | 136 #endif // defined(OS_CHROMEOS) |
137 | 137 |
138 namespace ash { | 138 namespace ash { |
139 | 139 |
140 namespace { | 140 namespace { |
141 | 141 |
142 using aura::Window; | 142 using aura::Window; |
143 using views::Widget; | 143 using views::Widget; |
144 | 144 |
145 // A Corewm VisibilityController subclass that calls the Ash animation routine | 145 // A Corewm VisibilityController subclass that calls the Ash animation routine |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 //////////////////////////////////////////////////////////////////////////////// | 600 //////////////////////////////////////////////////////////////////////////////// |
601 // Shell, private: | 601 // Shell, private: |
602 | 602 |
603 Shell::Shell(ShellDelegate* delegate) | 603 Shell::Shell(ShellDelegate* delegate) |
604 : target_root_window_(NULL), | 604 : target_root_window_(NULL), |
605 scoped_target_root_window_(NULL), | 605 scoped_target_root_window_(NULL), |
606 delegate_(delegate), | 606 delegate_(delegate), |
607 window_positioner_(new WindowPositioner), | 607 window_positioner_(new WindowPositioner), |
608 activation_client_(NULL), | 608 activation_client_(NULL), |
609 #if defined(OS_CHROMEOS) && defined(USE_X11) | 609 #if defined(OS_CHROMEOS) |
610 output_configurator_(new ui::OutputConfigurator()), | 610 output_configurator_(new ui::OutputConfigurator()), |
611 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 611 #endif // defined(OS_CHROMEOS) |
612 native_cursor_manager_(new AshNativeCursorManager), | 612 native_cursor_manager_(new AshNativeCursorManager), |
613 cursor_manager_(scoped_ptr< ::wm::NativeCursorManager>( | 613 cursor_manager_( |
614 native_cursor_manager_)), | 614 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), |
615 simulate_modal_window_open_for_testing_(false), | 615 simulate_modal_window_open_for_testing_(false), |
616 is_touch_hud_projection_enabled_(false) { | 616 is_touch_hud_projection_enabled_(false) { |
617 DCHECK(delegate_.get()); | 617 DCHECK(delegate_.get()); |
618 gpu_support_.reset(delegate_->CreateGPUSupport()); | 618 gpu_support_.reset(delegate_->CreateGPUSupport()); |
619 display_manager_.reset(new internal::DisplayManager); | 619 display_manager_.reset(new internal::DisplayManager); |
620 display_controller_.reset(new DisplayController); | 620 display_controller_.reset(new DisplayController); |
621 #if defined(OS_CHROMEOS) && defined(USE_X11) | 621 #if defined(OS_CHROMEOS) && defined(USE_X11) |
622 user_metrics_recorder_.reset(new UserMetricsRecorder); | 622 user_metrics_recorder_.reset(new UserMetricsRecorder); |
623 #endif // defined(OS_CHROMEOS) | 623 #endif // defined(OS_CHROMEOS) |
624 | 624 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 display_manager_->CreateScreenForShutdown(); | 755 display_manager_->CreateScreenForShutdown(); |
756 display_controller_->Shutdown(); | 756 display_controller_->Shutdown(); |
757 display_controller_.reset(); | 757 display_controller_.reset(); |
758 screen_position_controller_.reset(); | 758 screen_position_controller_.reset(); |
759 | 759 |
760 keyboard_controller_.reset(); | 760 keyboard_controller_.reset(); |
761 accessibility_delegate_.reset(); | 761 accessibility_delegate_.reset(); |
762 new_window_delegate_.reset(); | 762 new_window_delegate_.reset(); |
763 media_delegate_.reset(); | 763 media_delegate_.reset(); |
764 | 764 |
765 #if defined(OS_CHROMEOS) && defined(USE_X11) | 765 #if defined(OS_CHROMEOS) |
766 if (display_change_observer_) | 766 if (display_change_observer_) |
767 output_configurator_->RemoveObserver(display_change_observer_.get()); | 767 output_configurator_->RemoveObserver(display_change_observer_.get()); |
768 if (output_configurator_animation_) | 768 if (output_configurator_animation_) |
769 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 769 output_configurator_->RemoveObserver(output_configurator_animation_.get()); |
770 if (display_error_observer_) | 770 if (display_error_observer_) |
771 output_configurator_->RemoveObserver(display_error_observer_.get()); | 771 output_configurator_->RemoveObserver(display_error_observer_.get()); |
772 if (projecting_observer_) | 772 if (projecting_observer_) |
773 output_configurator_->RemoveObserver(projecting_observer_.get()); | 773 output_configurator_->RemoveObserver(projecting_observer_.get()); |
774 display_change_observer_.reset(); | 774 display_change_observer_.reset(); |
775 #endif // defined(OS_CHROMEOS) | 775 #endif // defined(OS_CHROMEOS) |
776 | 776 |
777 #if defined(OS_CHROMEOS) | 777 #if defined(OS_CHROMEOS) |
778 internal::PowerStatus::Shutdown(); | 778 internal::PowerStatus::Shutdown(); |
779 #endif | 779 #endif |
780 | 780 |
781 DCHECK(instance_ == this); | 781 DCHECK(instance_ == this); |
782 instance_ = NULL; | 782 instance_ = NULL; |
783 } | 783 } |
784 | 784 |
785 void Shell::Init() { | 785 void Shell::Init() { |
786 delegate_->PreInit(); | 786 delegate_->PreInit(); |
787 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 787 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
788 display_manager_->SetSecondDisplayMode( | 788 display_manager_->SetSecondDisplayMode( |
789 internal::DisplayManager::VIRTUAL_KEYBOARD); | 789 internal::DisplayManager::VIRTUAL_KEYBOARD); |
790 } | 790 } |
791 bool display_initialized = display_manager_->InitFromCommandLine(); | 791 bool display_initialized = display_manager_->InitFromCommandLine(); |
792 #if defined(OS_CHROMEOS) && defined(USE_X11) | 792 #if defined(OS_CHROMEOS) |
793 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 793 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
794 output_configurator_animation_.reset( | 794 output_configurator_animation_.reset( |
795 new internal::OutputConfiguratorAnimation()); | 795 new internal::OutputConfiguratorAnimation()); |
796 output_configurator_->AddObserver(output_configurator_animation_.get()); | 796 output_configurator_->AddObserver(output_configurator_animation_.get()); |
797 | 797 |
798 projecting_observer_.reset(new internal::ProjectingObserver()); | 798 projecting_observer_.reset(new internal::ProjectingObserver()); |
799 output_configurator_->AddObserver(projecting_observer_.get()); | 799 output_configurator_->AddObserver(projecting_observer_.get()); |
800 | 800 |
801 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { | 801 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { |
802 display_change_observer_.reset(new internal::DisplayChangeObserver); | 802 display_change_observer_.reset(new internal::DisplayChangeObserver); |
803 // Register |display_change_observer_| first so that the rest of | 803 // Register |display_change_observer_| first so that the rest of |
804 // observer gets invoked after the root windows are configured. | 804 // observer gets invoked after the root windows are configured. |
805 output_configurator_->AddObserver(display_change_observer_.get()); | 805 output_configurator_->AddObserver(display_change_observer_.get()); |
806 display_error_observer_.reset(new internal::DisplayErrorObserver()); | 806 display_error_observer_.reset(new internal::DisplayErrorObserver()); |
807 output_configurator_->AddObserver(display_error_observer_.get()); | 807 output_configurator_->AddObserver(display_error_observer_.get()); |
808 output_configurator_->set_state_controller(display_change_observer_.get()); | 808 output_configurator_->set_state_controller(display_change_observer_.get()); |
809 output_configurator_->set_mirroring_controller(display_manager_.get()); | 809 output_configurator_->set_mirroring_controller(display_manager_.get()); |
810 output_configurator_->ForceInitialConfigure( | 810 output_configurator_->ForceInitialConfigure( |
811 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); | 811 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); |
812 display_initialized = true; | 812 display_initialized = true; |
813 } | 813 } |
814 #endif // defined(OS_CHROMEOS) && defined(USE_X11) | 814 #endif // defined(OS_CHROMEOS) |
815 if (!display_initialized) | 815 if (!display_initialized) |
816 display_manager_->InitDefaultDisplay(); | 816 display_manager_->InitDefaultDisplay(); |
817 | 817 |
818 // Install the custom factory first so that views::FocusManagers for Tray, | 818 // Install the custom factory first so that views::FocusManagers for Tray, |
819 // Shelf, and WallPaper could be created by the factory. | 819 // Shelf, and WallPaper could be created by the factory. |
820 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 820 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
821 | 821 |
822 // Env creates the compositor. Historically it seems to have been implicitly | 822 // Env creates the compositor. Historically it seems to have been implicitly |
823 // initialized first by the ActivationController, but now that FocusController | 823 // initialized first by the ActivationController, but now that FocusController |
824 // no longer does this we need to do it explicitly. | 824 // no longer does this we need to do it explicitly. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 | 905 |
906 // The keyboard system must be initialized before the RootWindowController is | 906 // The keyboard system must be initialized before the RootWindowController is |
907 // created. | 907 // created. |
908 #if defined(OS_CHROMEOS) | 908 #if defined(OS_CHROMEOS) |
909 keyboard::InitializeKeyboard(); | 909 keyboard::InitializeKeyboard(); |
910 #endif | 910 #endif |
911 | 911 |
912 lock_state_controller_.reset(new LockStateController); | 912 lock_state_controller_.reset(new LockStateController); |
913 power_button_controller_.reset(new PowerButtonController( | 913 power_button_controller_.reset(new PowerButtonController( |
914 lock_state_controller_.get())); | 914 lock_state_controller_.get())); |
915 #if defined(OS_CHROMEOS) && defined(USE_X11) | 915 #if defined(OS_CHROMEOS) |
916 // Pass the initial display state to PowerButtonController. | 916 // Pass the initial display state to PowerButtonController. |
917 power_button_controller_->OnDisplayModeChanged( | 917 power_button_controller_->OnDisplayModeChanged( |
918 output_configurator_->cached_outputs()); | 918 output_configurator_->cached_outputs()); |
919 #endif | 919 #endif |
920 AddShellObserver(lock_state_controller_.get()); | 920 AddShellObserver(lock_state_controller_.get()); |
921 | 921 |
922 drag_drop_controller_.reset(new internal::DragDropController); | 922 drag_drop_controller_.reset(new internal::DragDropController); |
923 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); | 923 mouse_cursor_filter_.reset(new internal::MouseCursorEventFilter()); |
924 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 924 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
925 | 925 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 //////////////////////////////////////////////////////////////////////////////// | 1115 //////////////////////////////////////////////////////////////////////////////// |
1116 // Shell, aura::client::ActivationChangeObserver implementation: | 1116 // Shell, aura::client::ActivationChangeObserver implementation: |
1117 | 1117 |
1118 void Shell::OnWindowActivated(aura::Window* gained_active, | 1118 void Shell::OnWindowActivated(aura::Window* gained_active, |
1119 aura::Window* lost_active) { | 1119 aura::Window* lost_active) { |
1120 if (gained_active) | 1120 if (gained_active) |
1121 target_root_window_ = gained_active->GetRootWindow(); | 1121 target_root_window_ = gained_active->GetRootWindow(); |
1122 } | 1122 } |
1123 | 1123 |
1124 } // namespace ash | 1124 } // namespace ash |
OLD | NEW |