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 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
132 #include "ash/display/display_color_manager_chromeos.h" | 132 #include "ash/display/display_color_manager_chromeos.h" |
133 #include "ash/display/display_error_observer_chromeos.h" | 133 #include "ash/display/display_error_observer_chromeos.h" |
134 #include "ash/display/projecting_observer_chromeos.h" | 134 #include "ash/display/projecting_observer_chromeos.h" |
135 #include "ash/display/resolution_notification_controller.h" | 135 #include "ash/display/resolution_notification_controller.h" |
136 #include "ash/display/screen_orientation_controller_chromeos.h" | 136 #include "ash/display/screen_orientation_controller_chromeos.h" |
137 #include "ash/sticky_keys/sticky_keys_controller.h" | 137 #include "ash/sticky_keys/sticky_keys_controller.h" |
138 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" | 138 #include "ash/system/chromeos/bluetooth/bluetooth_notification_controller.h" |
139 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" | 139 #include "ash/system/chromeos/brightness/brightness_controller_chromeos.h" |
140 #include "ash/system/chromeos/power/power_event_observer.h" | 140 #include "ash/system/chromeos/power/power_event_observer.h" |
141 #include "ash/system/chromeos/power/video_activity_notifier.h" | 141 #include "ash/system/chromeos/power/video_activity_notifier.h" |
142 #include "ash/system/chromeos/session/last_window_closed_logout_reminder.h" | |
143 #include "ash/system/chromeos/session/logout_confirmation_controller.h" | |
144 #include "ash/touch/touch_transformer_controller.h" | 142 #include "ash/touch/touch_transformer_controller.h" |
145 #include "ash/virtual_keyboard_controller.h" | 143 #include "ash/virtual_keyboard_controller.h" |
146 #include "base/bind_helpers.h" | 144 #include "base/bind_helpers.h" |
147 #include "base/sys_info.h" | 145 #include "base/sys_info.h" |
148 #include "chromeos/audio/audio_a11y_controller.h" | 146 #include "chromeos/audio/audio_a11y_controller.h" |
149 #include "chromeos/dbus/dbus_thread_manager.h" | 147 #include "chromeos/dbus/dbus_thread_manager.h" |
150 #include "ui/chromeos/user_activity_power_manager_notifier.h" | 148 #include "ui/chromeos/user_activity_power_manager_notifier.h" |
151 #include "ui/display/chromeos/display_configurator.h" | 149 #include "ui/display/chromeos/display_configurator.h" |
152 | 150 |
153 #if defined(USE_X11) | 151 #if defined(USE_X11) |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 // to but no longer cares about. | 678 // to but no longer cares about. |
681 #if defined(OS_CHROMEOS) | 679 #if defined(OS_CHROMEOS) |
682 virtual_keyboard_controller_.reset(); | 680 virtual_keyboard_controller_.reset(); |
683 #endif | 681 #endif |
684 | 682 |
685 // Destroy maximize mode controller early on since it has some observers which | 683 // Destroy maximize mode controller early on since it has some observers which |
686 // need to be removed. | 684 // need to be removed. |
687 maximize_mode_controller_.reset(); | 685 maximize_mode_controller_.reset(); |
688 | 686 |
689 #if defined(OS_CHROMEOS) | 687 #if defined(OS_CHROMEOS) |
690 // Destroy the LastWindowClosedLogoutReminder before the | |
691 // LogoutConfirmationController. | |
692 last_window_closed_logout_reminder_.reset(); | |
693 | |
694 // Destroy the LogoutConfirmationController before the SystemTrayDelegate. | 688 // Destroy the LogoutConfirmationController before the SystemTrayDelegate. |
695 logout_confirmation_controller_.reset(); | 689 wm_shell_->DeleteLogoutConfirmationController(); |
msw
2016/06/28 19:31:04
It's unfortunate that ash::Shell controls the life
James Cook
2016/06/28 20:14:46
I moved the creation/deletion into WmShell. I spli
| |
696 #endif | 690 #endif |
697 | 691 |
698 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 692 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
699 // layout. | 693 // layout. |
700 DeactivateKeyboard(); | 694 DeactivateKeyboard(); |
701 | 695 |
702 // Destroy toasts | 696 // Destroy toasts |
703 toast_manager_.reset(); | 697 toast_manager_.reset(); |
704 | 698 |
705 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 699 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
706 // to deinitialize the shelf first, as it is initialized after the delegate. | 700 // to deinitialize the shelf first, as it is initialized after the delegate. |
707 ShutdownShelf(); | 701 ShutdownShelf(); |
708 wm_shell_->system_tray_delegate()->Shutdown(); | |
msw
2016/06/28 19:31:04
Nice, this is already part of WmShell::SetSystemTr
James Cook
2016/06/28 20:14:46
Removed the Shutdown() methods.
| |
709 wm_shell_->SetSystemTrayDelegate(nullptr); | 702 wm_shell_->SetSystemTrayDelegate(nullptr); |
710 | 703 |
711 locale_notification_controller_.reset(); | 704 locale_notification_controller_.reset(); |
712 | 705 |
713 // Drag-and-drop must be canceled prior to close all windows. | 706 // Drag-and-drop must be canceled prior to close all windows. |
714 drag_drop_controller_.reset(); | 707 drag_drop_controller_.reset(); |
715 | 708 |
716 // Controllers who have WindowObserver added must be deleted | 709 // Controllers who have WindowObserver added must be deleted |
717 // before |window_tree_host_manager_| is deleted. | 710 // before |window_tree_host_manager_| is deleted. |
718 | 711 |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1050 DCHECK(system_tray_delegate); | 1043 DCHECK(system_tray_delegate); |
1051 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); | 1044 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); |
1052 | 1045 |
1053 locale_notification_controller_.reset(new LocaleNotificationController); | 1046 locale_notification_controller_.reset(new LocaleNotificationController); |
1054 | 1047 |
1055 // Initialize toast manager | 1048 // Initialize toast manager |
1056 toast_manager_.reset(new ToastManager); | 1049 toast_manager_.reset(new ToastManager); |
1057 | 1050 |
1058 #if defined(OS_CHROMEOS) | 1051 #if defined(OS_CHROMEOS) |
1059 // Create the LogoutConfirmationController after the SystemTrayDelegate. | 1052 // Create the LogoutConfirmationController after the SystemTrayDelegate. |
1060 logout_confirmation_controller_.reset(new LogoutConfirmationController( | 1053 wm_shell_->CreateLogoutConfirmationController(); |
1061 base::Bind(&SystemTrayDelegate::SignOut, | |
1062 base::Unretained(system_tray_delegate)))); | |
1063 | 1054 |
1064 // Create TouchTransformerController before | 1055 // Create TouchTransformerController before |
1065 // WindowTreeHostManager::InitDisplays() | 1056 // WindowTreeHostManager::InitDisplays() |
1066 // since TouchTransformerController listens on | 1057 // since TouchTransformerController listens on |
1067 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). | 1058 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). |
1068 if (!in_mus_) | 1059 if (!in_mus_) |
1069 touch_transformer_controller_.reset(new TouchTransformerController()); | 1060 touch_transformer_controller_.reset(new TouchTransformerController()); |
1070 #endif // defined(OS_CHROMEOS) | 1061 #endif // defined(OS_CHROMEOS) |
1071 | 1062 |
1072 keyboard_ui_ = init_params.keyboard_factory.is_null() | 1063 keyboard_ui_ = init_params.keyboard_factory.is_null() |
(...skipping 30 matching lines...) Expand all Loading... | |
1103 accelerator_controller_->SetBrightnessControlDelegate( | 1094 accelerator_controller_->SetBrightnessControlDelegate( |
1104 std::unique_ptr<BrightnessControlDelegate>( | 1095 std::unique_ptr<BrightnessControlDelegate>( |
1105 new system::BrightnessControllerChromeos)); | 1096 new system::BrightnessControllerChromeos)); |
1106 | 1097 |
1107 power_event_observer_.reset(new PowerEventObserver()); | 1098 power_event_observer_.reset(new PowerEventObserver()); |
1108 user_activity_notifier_.reset( | 1099 user_activity_notifier_.reset( |
1109 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); | 1100 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); |
1110 video_activity_notifier_.reset( | 1101 video_activity_notifier_.reset( |
1111 new VideoActivityNotifier(video_detector_.get())); | 1102 new VideoActivityNotifier(video_detector_.get())); |
1112 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1103 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
1113 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); | |
1114 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1104 screen_orientation_controller_.reset(new ScreenOrientationController()); |
1115 #endif | 1105 #endif |
1116 // The compositor thread and main message loop have to be running in | 1106 // The compositor thread and main message loop have to be running in |
1117 // order to create mirror window. Run it after the main message loop | 1107 // order to create mirror window. Run it after the main message loop |
1118 // is started. | 1108 // is started. |
1119 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1109 display_manager_->CreateMirrorWindowAsyncIfAny(); |
1120 | 1110 |
1121 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 1111 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), |
1122 OnShellInitialized()); | 1112 OnShellInitialized()); |
1123 | 1113 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1200 | 1190 |
1201 void Shell::OnWindowActivated( | 1191 void Shell::OnWindowActivated( |
1202 aura::client::ActivationChangeObserver::ActivationReason reason, | 1192 aura::client::ActivationChangeObserver::ActivationReason reason, |
1203 aura::Window* gained_active, | 1193 aura::Window* gained_active, |
1204 aura::Window* lost_active) { | 1194 aura::Window* lost_active) { |
1205 if (gained_active) | 1195 if (gained_active) |
1206 target_root_window_ = gained_active->GetRootWindow(); | 1196 target_root_window_ = gained_active->GetRootWindow(); |
1207 } | 1197 } |
1208 | 1198 |
1209 } // namespace ash | 1199 } // namespace ash |
OLD | NEW |