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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #include "ui/wm/core/visibility_controller.h" | 113 #include "ui/wm/core/visibility_controller.h" |
114 #include "ui/wm/core/window_modality_controller.h" | 114 #include "ui/wm/core/window_modality_controller.h" |
115 | 115 |
116 #if defined(OS_CHROMEOS) | 116 #if defined(OS_CHROMEOS) |
117 #if defined(USE_X11) | 117 #if defined(USE_X11) |
118 #include "ui/gfx/x/x11_types.h" | 118 #include "ui/gfx/x/x11_types.h" |
119 #endif // defined(USE_X11) | 119 #endif // defined(USE_X11) |
120 #include "ash/accelerators/magnifier_key_scroller.h" | 120 #include "ash/accelerators/magnifier_key_scroller.h" |
121 #include "ash/accelerators/spoken_feedback_toggler.h" | 121 #include "ash/accelerators/spoken_feedback_toggler.h" |
122 #include "ash/ash_constants.h" | 122 #include "ash/ash_constants.h" |
123 #include "ash/content/display/screen_orientation_delegate_chromeos.h" | 123 #include "ash/content/display/screen_orientation_controller_chromeos.h" |
124 #include "ash/display/display_change_observer_chromeos.h" | 124 #include "ash/display/display_change_observer_chromeos.h" |
125 #include "ash/display/display_configurator_animation.h" | 125 #include "ash/display/display_configurator_animation.h" |
126 #include "ash/display/display_error_observer_chromeos.h" | 126 #include "ash/display/display_error_observer_chromeos.h" |
127 #include "ash/display/projecting_observer_chromeos.h" | 127 #include "ash/display/projecting_observer_chromeos.h" |
128 #include "ash/display/resolution_notification_controller.h" | 128 #include "ash/display/resolution_notification_controller.h" |
129 #include "ash/sticky_keys/sticky_keys_controller.h" | 129 #include "ash/sticky_keys/sticky_keys_controller.h" |
130 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" | 130 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" |
131 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" | 131 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" |
132 #include "ash/system/chromeos/power/power_event_observer.h" | 132 #include "ash/system/chromeos/power/power_event_observer.h" |
133 #include "ash/system/chromeos/power/power_status.h" | 133 #include "ash/system/chromeos/power/power_status.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 void Shell::AddShellObserver(ShellObserver* observer) { | 478 void Shell::AddShellObserver(ShellObserver* observer) { |
479 observers_.AddObserver(observer); | 479 observers_.AddObserver(observer); |
480 } | 480 } |
481 | 481 |
482 void Shell::RemoveShellObserver(ShellObserver* observer) { | 482 void Shell::RemoveShellObserver(ShellObserver* observer) { |
483 observers_.RemoveObserver(observer); | 483 observers_.RemoveObserver(observer); |
484 } | 484 } |
485 | 485 |
486 #if defined(OS_CHROMEOS) | 486 #if defined(OS_CHROMEOS) |
487 bool Shell::ShouldSaveDisplaySettings() { | 487 bool Shell::ShouldSaveDisplaySettings() { |
488 return !((maximize_mode_controller_->IsMaximizeModeWindowManagerEnabled() && | 488 return !(screen_orientation_controller_ |
489 maximize_mode_controller_-> | 489 ->ignore_display_configuration_updates() || |
490 ignore_display_configuration_updates()) || | |
491 resolution_notification_controller_->DoesNotificationTimeout()); | 490 resolution_notification_controller_->DoesNotificationTimeout()); |
492 } | 491 } |
493 #endif | 492 #endif |
494 | 493 |
495 void Shell::UpdateShelfVisibility() { | 494 void Shell::UpdateShelfVisibility() { |
496 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 495 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
497 for (RootWindowControllerList::iterator iter = controllers.begin(); | 496 for (RootWindowControllerList::iterator iter = controllers.begin(); |
498 iter != controllers.end(); ++iter) | 497 iter != controllers.end(); ++iter) |
499 if ((*iter)->shelf()) | 498 if ((*iter)->shelf()) |
500 (*iter)->UpdateShelfVisibility(); | 499 (*iter)->UpdateShelfVisibility(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 RemovePreTargetHandler(event_transformation_handler_.get()); | 686 RemovePreTargetHandler(event_transformation_handler_.get()); |
688 RemovePreTargetHandler(toplevel_window_event_handler_.get()); | 687 RemovePreTargetHandler(toplevel_window_event_handler_.get()); |
689 RemovePostTargetHandler(toplevel_window_event_handler_.get()); | 688 RemovePostTargetHandler(toplevel_window_event_handler_.get()); |
690 RemovePreTargetHandler(system_gesture_filter_.get()); | 689 RemovePreTargetHandler(system_gesture_filter_.get()); |
691 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 690 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
692 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 691 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
693 | 692 |
694 // TooltipController is deleted with the Shell so removing its references. | 693 // TooltipController is deleted with the Shell so removing its references. |
695 RemovePreTargetHandler(tooltip_controller_.get()); | 694 RemovePreTargetHandler(tooltip_controller_.get()); |
696 | 695 |
| 696 #if defined(OS_CHROMEOS) |
| 697 screen_orientation_controller_.reset(); |
| 698 #endif |
| 699 |
697 // Destroy the virtual keyboard controller before the maximize mode controller | 700 // Destroy the virtual keyboard controller before the maximize mode controller |
698 // since the latters destructor triggers events that the former is listening | 701 // since the latters destructor triggers events that the former is listening |
699 // to but no longer cares about. | 702 // to but no longer cares about. |
700 #if defined(OS_CHROMEOS) | 703 #if defined(OS_CHROMEOS) |
701 virtual_keyboard_controller_.reset(); | 704 virtual_keyboard_controller_.reset(); |
702 #endif | 705 #endif |
| 706 |
703 // Destroy maximize mode controller early on since it has some observers which | 707 // Destroy maximize mode controller early on since it has some observers which |
704 // need to be removed. | 708 // need to be removed. |
705 maximize_mode_controller_->Shutdown(); | |
706 maximize_mode_controller_.reset(); | 709 maximize_mode_controller_.reset(); |
707 | 710 |
708 // AppList needs to be released before shelf layout manager, which is | 711 // AppList needs to be released before shelf layout manager, which is |
709 // destroyed with shelf container in the loop below. However, app list | 712 // destroyed with shelf container in the loop below. However, app list |
710 // container is now on top of shelf container and released after it. | 713 // container is now on top of shelf container and released after it. |
711 // TODO(xiyuan): Move it back when app list container is no longer needed. | 714 // TODO(xiyuan): Move it back when app list container is no longer needed. |
712 app_list_controller_.reset(); | 715 app_list_controller_.reset(); |
713 | 716 |
714 #if defined(OS_CHROMEOS) | 717 #if defined(OS_CHROMEOS) |
715 // Destroy the LastWindowClosedLogoutReminder before the | 718 // Destroy the LastWindowClosedLogoutReminder before the |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 scoped_ptr<ash::BrightnessControlDelegate>( | 1062 scoped_ptr<ash::BrightnessControlDelegate>( |
1060 new ash::system::BrightnessControllerChromeos).Pass()); | 1063 new ash::system::BrightnessControllerChromeos).Pass()); |
1061 | 1064 |
1062 power_event_observer_.reset(new PowerEventObserver()); | 1065 power_event_observer_.reset(new PowerEventObserver()); |
1063 user_activity_notifier_.reset( | 1066 user_activity_notifier_.reset( |
1064 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1067 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
1065 video_activity_notifier_.reset( | 1068 video_activity_notifier_.reset( |
1066 new VideoActivityNotifier(video_detector_.get())); | 1069 new VideoActivityNotifier(video_detector_.get())); |
1067 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1070 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
1068 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); | 1071 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); |
1069 screen_orientation_delegate_.reset(new ScreenOrientationDelegate()); | 1072 screen_orientation_controller_.reset(new ScreenOrientationController()); |
1070 #endif | 1073 #endif |
1071 // The compositor thread and main message loop have to be running in | 1074 // The compositor thread and main message loop have to be running in |
1072 // order to create mirror window. Run it after the main message loop | 1075 // order to create mirror window. Run it after the main message loop |
1073 // is started. | 1076 // is started. |
1074 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1077 display_manager_->CreateMirrorWindowAsyncIfAny(); |
1075 } | 1078 } |
1076 | 1079 |
1077 void Shell::InitKeyboard() { | 1080 void Shell::InitKeyboard() { |
1078 if (keyboard::IsKeyboardEnabled()) { | 1081 if (keyboard::IsKeyboardEnabled()) { |
1079 if (keyboard::KeyboardController::GetInstance()) { | 1082 if (keyboard::KeyboardController::GetInstance()) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 //////////////////////////////////////////////////////////////////////////////// | 1167 //////////////////////////////////////////////////////////////////////////////// |
1165 // Shell, aura::client::ActivationChangeObserver implementation: | 1168 // Shell, aura::client::ActivationChangeObserver implementation: |
1166 | 1169 |
1167 void Shell::OnWindowActivated(aura::Window* gained_active, | 1170 void Shell::OnWindowActivated(aura::Window* gained_active, |
1168 aura::Window* lost_active) { | 1171 aura::Window* lost_active) { |
1169 if (gained_active) | 1172 if (gained_active) |
1170 target_root_window_ = gained_active->GetRootWindow(); | 1173 target_root_window_ = gained_active->GetRootWindow(); |
1171 } | 1174 } |
1172 | 1175 |
1173 } // namespace ash | 1176 } // namespace ash |
OLD | NEW |