| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" | 127 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" |
| 128 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" | 128 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" |
| 129 #include "ash/system/chromeos/power/power_event_observer.h" | 129 #include "ash/system/chromeos/power/power_event_observer.h" |
| 130 #include "ash/system/chromeos/power/power_status.h" | 130 #include "ash/system/chromeos/power/power_status.h" |
| 131 #include "ash/system/chromeos/power/user_activity_notifier.h" | 131 #include "ash/system/chromeos/power/user_activity_notifier.h" |
| 132 #include "ash/system/chromeos/power/video_activity_notifier.h" | 132 #include "ash/system/chromeos/power/video_activity_notifier.h" |
| 133 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" | 133 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" |
| 134 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | 134 #include "ash/system/chromeos/session/logout_confirmation_controller.h" |
| 135 #include "base/bind_helpers.h" | 135 #include "base/bind_helpers.h" |
| 136 #include "base/sys_info.h" | 136 #include "base/sys_info.h" |
| 137 #include "ui/display/chromeos/output_configurator.h" | 137 #include "ui/display/chromeos/display_configurator.h" |
| 138 #endif // defined(OS_CHROMEOS) | 138 #endif // defined(OS_CHROMEOS) |
| 139 | 139 |
| 140 namespace ash { | 140 namespace ash { |
| 141 | 141 |
| 142 namespace { | 142 namespace { |
| 143 | 143 |
| 144 using aura::Window; | 144 using aura::Window; |
| 145 using views::Widget; | 145 using views::Widget; |
| 146 | 146 |
| 147 // A Corewm VisibilityController subclass that calls the Ash animation routine | 147 // A Corewm VisibilityController subclass that calls the Ash animation routine |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // Shell, private: | 596 // Shell, private: |
| 597 | 597 |
| 598 Shell::Shell(ShellDelegate* delegate) | 598 Shell::Shell(ShellDelegate* delegate) |
| 599 : target_root_window_(NULL), | 599 : target_root_window_(NULL), |
| 600 scoped_target_root_window_(NULL), | 600 scoped_target_root_window_(NULL), |
| 601 delegate_(delegate), | 601 delegate_(delegate), |
| 602 window_positioner_(new WindowPositioner), | 602 window_positioner_(new WindowPositioner), |
| 603 activation_client_(NULL), | 603 activation_client_(NULL), |
| 604 accelerometer_controller_(new AccelerometerController()), | 604 accelerometer_controller_(new AccelerometerController()), |
| 605 #if defined(OS_CHROMEOS) | 605 #if defined(OS_CHROMEOS) |
| 606 output_configurator_(new ui::OutputConfigurator()), | 606 display_configurator_(new ui::DisplayConfigurator()), |
| 607 #endif // defined(OS_CHROMEOS) | 607 #endif // defined(OS_CHROMEOS) |
| 608 native_cursor_manager_(new AshNativeCursorManager), | 608 native_cursor_manager_(new AshNativeCursorManager), |
| 609 cursor_manager_( | 609 cursor_manager_( |
| 610 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), | 610 scoped_ptr< ::wm::NativeCursorManager>(native_cursor_manager_)), |
| 611 simulate_modal_window_open_for_testing_(false), | 611 simulate_modal_window_open_for_testing_(false), |
| 612 is_touch_hud_projection_enabled_(false) { | 612 is_touch_hud_projection_enabled_(false) { |
| 613 DCHECK(delegate_.get()); | 613 DCHECK(delegate_.get()); |
| 614 gpu_support_.reset(delegate_->CreateGPUSupport()); | 614 gpu_support_.reset(delegate_->CreateGPUSupport()); |
| 615 display_manager_.reset(new DisplayManager); | 615 display_manager_.reset(new DisplayManager); |
| 616 display_controller_.reset(new DisplayController); | 616 display_controller_.reset(new DisplayController); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 display_controller_.reset(); | 754 display_controller_.reset(); |
| 755 screen_position_controller_.reset(); | 755 screen_position_controller_.reset(); |
| 756 | 756 |
| 757 keyboard_controller_.reset(); | 757 keyboard_controller_.reset(); |
| 758 accessibility_delegate_.reset(); | 758 accessibility_delegate_.reset(); |
| 759 new_window_delegate_.reset(); | 759 new_window_delegate_.reset(); |
| 760 media_delegate_.reset(); | 760 media_delegate_.reset(); |
| 761 | 761 |
| 762 #if defined(OS_CHROMEOS) | 762 #if defined(OS_CHROMEOS) |
| 763 if (display_change_observer_) | 763 if (display_change_observer_) |
| 764 output_configurator_->RemoveObserver(display_change_observer_.get()); | 764 display_configurator_->RemoveObserver(display_change_observer_.get()); |
| 765 if (output_configurator_animation_) | 765 if (output_configurator_animation_) |
| 766 output_configurator_->RemoveObserver(output_configurator_animation_.get()); | 766 display_configurator_->RemoveObserver(output_configurator_animation_.get()); |
| 767 if (display_error_observer_) | 767 if (display_error_observer_) |
| 768 output_configurator_->RemoveObserver(display_error_observer_.get()); | 768 display_configurator_->RemoveObserver(display_error_observer_.get()); |
| 769 if (projecting_observer_) | 769 if (projecting_observer_) |
| 770 output_configurator_->RemoveObserver(projecting_observer_.get()); | 770 display_configurator_->RemoveObserver(projecting_observer_.get()); |
| 771 display_change_observer_.reset(); | 771 display_change_observer_.reset(); |
| 772 #endif // defined(OS_CHROMEOS) | 772 #endif // defined(OS_CHROMEOS) |
| 773 | 773 |
| 774 #if defined(OS_CHROMEOS) | 774 #if defined(OS_CHROMEOS) |
| 775 PowerStatus::Shutdown(); | 775 PowerStatus::Shutdown(); |
| 776 #endif | 776 #endif |
| 777 | 777 |
| 778 DCHECK(instance_ == this); | 778 DCHECK(instance_ == this); |
| 779 instance_ = NULL; | 779 instance_ = NULL; |
| 780 } | 780 } |
| 781 | 781 |
| 782 void Shell::Init() { | 782 void Shell::Init() { |
| 783 delegate_->PreInit(); | 783 delegate_->PreInit(); |
| 784 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { | 784 if (keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
| 785 display_manager_->SetSecondDisplayMode(DisplayManager::VIRTUAL_KEYBOARD); | 785 display_manager_->SetSecondDisplayMode(DisplayManager::VIRTUAL_KEYBOARD); |
| 786 } | 786 } |
| 787 bool display_initialized = display_manager_->InitFromCommandLine(); | 787 bool display_initialized = display_manager_->InitFromCommandLine(); |
| 788 #if defined(OS_CHROMEOS) | 788 #if defined(OS_CHROMEOS) |
| 789 output_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); | 789 display_configurator_->Init(!gpu_support_->IsPanelFittingDisabled()); |
| 790 output_configurator_animation_.reset(new OutputConfiguratorAnimation()); | 790 output_configurator_animation_.reset(new OutputConfiguratorAnimation()); |
| 791 output_configurator_->AddObserver(output_configurator_animation_.get()); | 791 display_configurator_->AddObserver(output_configurator_animation_.get()); |
| 792 | 792 |
| 793 projecting_observer_.reset(new ProjectingObserver()); | 793 projecting_observer_.reset(new ProjectingObserver()); |
| 794 output_configurator_->AddObserver(projecting_observer_.get()); | 794 display_configurator_->AddObserver(projecting_observer_.get()); |
| 795 | 795 |
| 796 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { | 796 if (!display_initialized && base::SysInfo::IsRunningOnChromeOS()) { |
| 797 display_change_observer_.reset(new DisplayChangeObserver); | 797 display_change_observer_.reset(new DisplayChangeObserver); |
| 798 // Register |display_change_observer_| first so that the rest of | 798 // Register |display_change_observer_| first so that the rest of |
| 799 // observer gets invoked after the root windows are configured. | 799 // observer gets invoked after the root windows are configured. |
| 800 output_configurator_->AddObserver(display_change_observer_.get()); | 800 display_configurator_->AddObserver(display_change_observer_.get()); |
| 801 display_error_observer_.reset(new DisplayErrorObserver()); | 801 display_error_observer_.reset(new DisplayErrorObserver()); |
| 802 output_configurator_->AddObserver(display_error_observer_.get()); | 802 display_configurator_->AddObserver(display_error_observer_.get()); |
| 803 output_configurator_->set_state_controller(display_change_observer_.get()); | 803 display_configurator_->set_state_controller(display_change_observer_.get()); |
| 804 output_configurator_->set_mirroring_controller(display_manager_.get()); | 804 display_configurator_->set_mirroring_controller(display_manager_.get()); |
| 805 output_configurator_->ForceInitialConfigure( | 805 display_configurator_->ForceInitialConfigure( |
| 806 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); | 806 delegate_->IsFirstRunAfterBoot() ? kChromeOsBootColor : 0); |
| 807 display_initialized = true; | 807 display_initialized = true; |
| 808 } | 808 } |
| 809 #endif // defined(OS_CHROMEOS) | 809 #endif // defined(OS_CHROMEOS) |
| 810 if (!display_initialized) | 810 if (!display_initialized) |
| 811 display_manager_->InitDefaultDisplay(); | 811 display_manager_->InitDefaultDisplay(); |
| 812 | 812 |
| 813 // Install the custom factory first so that views::FocusManagers for Tray, | 813 // Install the custom factory first so that views::FocusManagers for Tray, |
| 814 // Shelf, and WallPaper could be created by the factory. | 814 // Shelf, and WallPaper could be created by the factory. |
| 815 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 815 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 #if defined(OS_CHROMEOS) | 904 #if defined(OS_CHROMEOS) |
| 905 keyboard::InitializeKeyboard(); | 905 keyboard::InitializeKeyboard(); |
| 906 #endif | 906 #endif |
| 907 | 907 |
| 908 lock_state_controller_.reset(new LockStateController); | 908 lock_state_controller_.reset(new LockStateController); |
| 909 power_button_controller_.reset(new PowerButtonController( | 909 power_button_controller_.reset(new PowerButtonController( |
| 910 lock_state_controller_.get())); | 910 lock_state_controller_.get())); |
| 911 #if defined(OS_CHROMEOS) | 911 #if defined(OS_CHROMEOS) |
| 912 // Pass the initial display state to PowerButtonController. | 912 // Pass the initial display state to PowerButtonController. |
| 913 power_button_controller_->OnDisplayModeChanged( | 913 power_button_controller_->OnDisplayModeChanged( |
| 914 output_configurator_->cached_outputs()); | 914 display_configurator_->cached_outputs()); |
| 915 #endif | 915 #endif |
| 916 AddShellObserver(lock_state_controller_.get()); | 916 AddShellObserver(lock_state_controller_.get()); |
| 917 | 917 |
| 918 drag_drop_controller_.reset(new DragDropController); | 918 drag_drop_controller_.reset(new DragDropController); |
| 919 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); | 919 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); |
| 920 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 920 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
| 921 | 921 |
| 922 // Create Controllers that may need root window. | 922 // Create Controllers that may need root window. |
| 923 // TODO(oshima): Move as many controllers before creating | 923 // TODO(oshima): Move as many controllers before creating |
| 924 // RootWindowController as possible. | 924 // RootWindowController as possible. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 //////////////////////////////////////////////////////////////////////////////// | 1110 //////////////////////////////////////////////////////////////////////////////// |
| 1111 // Shell, aura::client::ActivationChangeObserver implementation: | 1111 // Shell, aura::client::ActivationChangeObserver implementation: |
| 1112 | 1112 |
| 1113 void Shell::OnWindowActivated(aura::Window* gained_active, | 1113 void Shell::OnWindowActivated(aura::Window* gained_active, |
| 1114 aura::Window* lost_active) { | 1114 aura::Window* lost_active) { |
| 1115 if (gained_active) | 1115 if (gained_active) |
| 1116 target_root_window_ = gained_active->GetRootWindow(); | 1116 target_root_window_ = gained_active->GetRootWindow(); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 } // namespace ash | 1119 } // namespace ash |
| OLD | NEW |