Chromium Code Reviews| 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 |
| 11 #include "ash/accelerators/accelerator_controller.h" | 11 #include "ash/accelerators/accelerator_controller.h" |
| 12 #include "ash/accelerators/accelerator_delegate.h" | 12 #include "ash/accelerators/accelerator_delegate.h" |
| 13 #include "ash/accelerators/focus_manager_factory.h" | 13 #include "ash/accelerators/focus_manager_factory.h" |
| 14 #include "ash/ash_switches.h" | 14 #include "ash/ash_switches.h" |
| 15 #include "ash/aura/wm_shell_aura.h" | 15 #include "ash/aura/wm_shell_aura.h" |
| 16 #include "ash/aura/wm_window_aura.h" | 16 #include "ash/aura/wm_window_aura.h" |
| 17 #include "ash/autoclick/autoclick_controller.h" | 17 #include "ash/autoclick/autoclick_controller.h" |
| 18 #include "ash/common/session/session_state_delegate.h" | 18 #include "ash/common/session/session_state_delegate.h" |
| 19 #include "ash/common/shelf/shelf_item_delegate.h" | 19 #include "ash/common/shelf/shelf_item_delegate.h" |
| 20 #include "ash/common/shelf/shelf_item_delegate_manager.h" | 20 #include "ash/common/shelf/shelf_item_delegate_manager.h" |
| 21 #include "ash/common/shelf/shelf_model.h" | 21 #include "ash/common/shelf/shelf_model.h" |
| 22 #include "ash/common/shell_window_ids.h" | 22 #include "ash/common/shell_window_ids.h" |
| 23 #include "ash/common/system/tray/system_tray_delegate.h" | 23 #include "ash/common/system/tray/system_tray_delegate.h" |
| 24 #include "ash/common/wm/mru_window_tracker.h" | 24 #include "ash/common/wm/mru_window_tracker.h" |
| 25 #include "ash/common/wm/root_window_finder.h" | 25 #include "ash/common/wm/root_window_finder.h" |
| 26 #include "ash/common/wm/window_positioner.h" | 26 #include "ash/common/wm/window_positioner.h" |
| 27 #include "ash/common/wm_shell.h" | |
| 27 #include "ash/common/wm_shell_common.h" | 28 #include "ash/common/wm_shell_common.h" |
| 28 #include "ash/container_delegate.h" | 29 #include "ash/container_delegate.h" |
| 29 #include "ash/desktop_background/desktop_background_controller.h" | 30 #include "ash/desktop_background/desktop_background_controller.h" |
| 30 #include "ash/desktop_background/desktop_background_view.h" | 31 #include "ash/desktop_background/desktop_background_view.h" |
| 31 #include "ash/desktop_background/user_wallpaper_delegate.h" | 32 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 32 #include "ash/display/cursor_window_controller.h" | 33 #include "ash/display/cursor_window_controller.h" |
| 33 #include "ash/display/display_configuration_controller.h" | 34 #include "ash/display/display_configuration_controller.h" |
| 34 #include "ash/display/display_manager.h" | 35 #include "ash/display/display_manager.h" |
| 35 #include "ash/display/event_transformation_handler.h" | 36 #include "ash/display/event_transformation_handler.h" |
| 36 #include "ash/display/mouse_cursor_event_filter.h" | 37 #include "ash/display/mouse_cursor_event_filter.h" |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 720 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 721 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
| 721 // layout. | 722 // layout. |
| 722 DeactivateKeyboard(); | 723 DeactivateKeyboard(); |
| 723 | 724 |
| 724 // Destroy toasts | 725 // Destroy toasts |
| 725 toast_manager_.reset(); | 726 toast_manager_.reset(); |
| 726 | 727 |
| 727 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 728 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
| 728 // to deinitialize the shelf first, as it is initialized after the delegate. | 729 // to deinitialize the shelf first, as it is initialized after the delegate. |
| 729 ShutdownShelf(); | 730 ShutdownShelf(); |
| 730 system_tray_delegate_->Shutdown(); | 731 wm_shell_->system_tray_delegate()->Shutdown(); |
| 731 system_tray_delegate_.reset(); | 732 wm_shell_->SetSystemTrayDelegate(nullptr); |
| 732 | 733 |
| 733 locale_notification_controller_.reset(); | 734 locale_notification_controller_.reset(); |
| 734 | 735 |
| 735 // Drag-and-drop must be canceled prior to close all windows. | 736 // Drag-and-drop must be canceled prior to close all windows. |
| 736 drag_drop_controller_.reset(); | 737 drag_drop_controller_.reset(); |
| 737 | 738 |
| 738 // Controllers who have WindowObserver added must be deleted | 739 // Controllers who have WindowObserver added must be deleted |
| 739 // before |window_tree_host_manager_| is deleted. | 740 // before |window_tree_host_manager_| is deleted. |
| 740 | 741 |
| 741 #if defined(OS_CHROMEOS) | 742 #if defined(OS_CHROMEOS) |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1072 container_delegate_ = delegate_->CreateContainerDelegate(); | 1073 container_delegate_ = delegate_->CreateContainerDelegate(); |
| 1073 pointer_watcher_delegate_ = delegate_->CreatePointerWatcherDelegate(); | 1074 pointer_watcher_delegate_ = delegate_->CreatePointerWatcherDelegate(); |
| 1074 | 1075 |
| 1075 resize_shadow_controller_.reset(new ResizeShadowController()); | 1076 resize_shadow_controller_.reset(new ResizeShadowController()); |
| 1076 shadow_controller_.reset( | 1077 shadow_controller_.reset( |
| 1077 new ::wm::ShadowController(activation_client_)); | 1078 new ::wm::ShadowController(activation_client_)); |
| 1078 | 1079 |
| 1079 // Create system_tray_notifier_ before the delegate. | 1080 // Create system_tray_notifier_ before the delegate. |
| 1080 system_tray_notifier_.reset(new SystemTrayNotifier()); | 1081 system_tray_notifier_.reset(new SystemTrayNotifier()); |
| 1081 | 1082 |
| 1082 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. | 1083 // Initialize system tray delegate before initializing StatusAreaWidget. |
|
msw
2016/06/10 18:48:20
I don't think these StatusAreaWidget comments are
James Cook
2016/06/10 20:20:29
I removed the comments and moved initialization/sh
| |
| 1083 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); | 1084 SystemTrayDelegate* system_tray_delegate = |
| 1084 DCHECK(system_tray_delegate_.get()); | 1085 delegate()->CreateSystemTrayDelegate(); |
| 1086 DCHECK(system_tray_delegate); | |
| 1087 wm_shell_->SetSystemTrayDelegate(base::WrapUnique(system_tray_delegate)); | |
| 1085 | 1088 |
| 1086 locale_notification_controller_.reset(new LocaleNotificationController); | 1089 locale_notification_controller_.reset(new LocaleNotificationController); |
| 1087 | 1090 |
| 1088 // Initialize system_tray_delegate_ after StatusAreaWidget is created. | 1091 // Initialize system tray delegate after StatusAreaWidget is created. |
| 1089 system_tray_delegate_->Initialize(); | 1092 wm_shell_->system_tray_delegate()->Initialize(); |
| 1090 | 1093 |
| 1091 // Initialize toast manager | 1094 // Initialize toast manager |
| 1092 toast_manager_.reset(new ToastManager); | 1095 toast_manager_.reset(new ToastManager); |
| 1093 | 1096 |
| 1094 #if defined(OS_CHROMEOS) | 1097 #if defined(OS_CHROMEOS) |
| 1095 // Create the LogoutConfirmationController after the SystemTrayDelegate. | 1098 // Create the LogoutConfirmationController after the SystemTrayDelegate. |
| 1096 logout_confirmation_controller_.reset(new LogoutConfirmationController( | 1099 logout_confirmation_controller_.reset(new LogoutConfirmationController( |
| 1097 base::Bind(&SystemTrayDelegate::SignOut, | 1100 base::Bind(&SystemTrayDelegate::SignOut, |
| 1098 base::Unretained(system_tray_delegate_.get())))); | 1101 base::Unretained(system_tray_delegate)))); |
| 1099 | 1102 |
| 1100 // Create TouchTransformerController before | 1103 // Create TouchTransformerController before |
| 1101 // WindowTreeHostManager::InitDisplays() | 1104 // WindowTreeHostManager::InitDisplays() |
| 1102 // since TouchTransformerController listens on | 1105 // since TouchTransformerController listens on |
| 1103 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). | 1106 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). |
| 1104 if (!in_mus_) | 1107 if (!in_mus_) |
| 1105 touch_transformer_controller_.reset(new TouchTransformerController()); | 1108 touch_transformer_controller_.reset(new TouchTransformerController()); |
| 1106 #endif // defined(OS_CHROMEOS) | 1109 #endif // defined(OS_CHROMEOS) |
| 1107 | 1110 |
| 1108 keyboard_ui_ = init_params.keyboard_factory.is_null() | 1111 keyboard_ui_ = init_params.keyboard_factory.is_null() |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1244 | 1247 |
| 1245 void Shell::OnWindowActivated( | 1248 void Shell::OnWindowActivated( |
| 1246 aura::client::ActivationChangeObserver::ActivationReason reason, | 1249 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1247 aura::Window* gained_active, | 1250 aura::Window* gained_active, |
| 1248 aura::Window* lost_active) { | 1251 aura::Window* lost_active) { |
| 1249 if (gained_active) | 1252 if (gained_active) |
| 1250 target_root_window_ = gained_active->GetRootWindow(); | 1253 target_root_window_ = gained_active->GetRootWindow(); |
| 1251 } | 1254 } |
| 1252 | 1255 |
| 1253 } // namespace ash | 1256 } // namespace ash |
| OLD | NEW |