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/focus_manager_factory.h" | 10 #include "ash/accelerators/focus_manager_factory.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ash/focus_cycler.h" | 21 #include "ash/focus_cycler.h" |
22 #include "ash/high_contrast/high_contrast_controller.h" | 22 #include "ash/high_contrast/high_contrast_controller.h" |
23 #include "ash/magnifier/magnification_controller.h" | 23 #include "ash/magnifier/magnification_controller.h" |
24 #include "ash/root_window_controller.h" | 24 #include "ash/root_window_controller.h" |
25 #include "ash/screen_ash.h" | 25 #include "ash/screen_ash.h" |
26 #include "ash/shell_delegate.h" | 26 #include "ash/shell_delegate.h" |
27 #include "ash/shell_factory.h" | 27 #include "ash/shell_factory.h" |
28 #include "ash/shell_window_ids.h" | 28 #include "ash/shell_window_ids.h" |
29 #include "ash/system/status_area_widget.h" | 29 #include "ash/system/status_area_widget.h" |
30 #include "ash/system/tray/system_tray_delegate.h" | 30 #include "ash/system/tray/system_tray_delegate.h" |
| 31 #include "ash/system/tray/system_tray_notifier.h" |
31 #include "ash/tooltips/tooltip_controller.h" | 32 #include "ash/tooltips/tooltip_controller.h" |
32 #include "ash/touch/touch_observer_hud.h" | 33 #include "ash/touch/touch_observer_hud.h" |
33 #include "ash/wm/activation_controller.h" | 34 #include "ash/wm/activation_controller.h" |
34 #include "ash/wm/always_on_top_controller.h" | 35 #include "ash/wm/always_on_top_controller.h" |
35 #include "ash/wm/app_list_controller.h" | 36 #include "ash/wm/app_list_controller.h" |
36 #include "ash/wm/base_layout_manager.h" | 37 #include "ash/wm/base_layout_manager.h" |
37 #include "ash/wm/capture_controller.h" | 38 #include "ash/wm/capture_controller.h" |
38 #include "ash/wm/coordinate_conversion.h" | 39 #include "ash/wm/coordinate_conversion.h" |
39 #include "ash/wm/custom_frame_view_ash.h" | 40 #include "ash/wm/custom_frame_view_ash.h" |
40 #include "ash/wm/dialog_frame_view.h" | 41 #include "ash/wm/dialog_frame_view.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 249 |
249 // AppList needs to be released before shelf layout manager, which is | 250 // AppList needs to be released before shelf layout manager, which is |
250 // destroyed with launcher container in the loop below. However, app list | 251 // destroyed with launcher container in the loop below. However, app list |
251 // container is now on top of launcher container and released after it. | 252 // container is now on top of launcher container and released after it. |
252 // TODO(xiyuan): Move it back when app list container is no longer needed. | 253 // TODO(xiyuan): Move it back when app list container is no longer needed. |
253 app_list_controller_.reset(); | 254 app_list_controller_.reset(); |
254 | 255 |
255 // Destroy SystemTrayDelegate before destroying the status area(s). | 256 // Destroy SystemTrayDelegate before destroying the status area(s). |
256 system_tray_delegate_.reset(); | 257 system_tray_delegate_.reset(); |
257 | 258 |
| 259 // Destroy SystemTrayNotifier immediately after destroying SystemTrayDelegate |
| 260 // so that it is still available when shutting down the UI, but not after |
| 261 // the notifier observers have been destroyed. |
| 262 system_tray_notifier_.reset(); |
| 263 |
258 // Destroy all child windows including widgets. | 264 // Destroy all child windows including widgets. |
259 display_controller_->CloseChildWindows(); | 265 display_controller_->CloseChildWindows(); |
260 | 266 |
261 // These need a valid Shell instance to clean up properly, so explicitly | 267 // These need a valid Shell instance to clean up properly, so explicitly |
262 // delete them before invalidating the instance. | 268 // delete them before invalidating the instance. |
263 // Alphabetical. | 269 // Alphabetical. |
264 drag_drop_controller_.reset(); | 270 drag_drop_controller_.reset(); |
265 magnification_controller_.reset(); | 271 magnification_controller_.reset(); |
266 power_button_controller_.reset(); | 272 power_button_controller_.reset(); |
267 session_state_controller_.reset(); | 273 session_state_controller_.reset(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); | 490 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); |
485 | 491 |
486 // StatusAreaWidget uses Shell's CapsLockDelegate. | 492 // StatusAreaWidget uses Shell's CapsLockDelegate. |
487 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); | 493 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); |
488 | 494 |
489 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { | 495 if (!command_line->HasSwitch(switches::kAuraNoShadows)) { |
490 resize_shadow_controller_.reset(new internal::ResizeShadowController()); | 496 resize_shadow_controller_.reset(new internal::ResizeShadowController()); |
491 shadow_controller_.reset(new internal::ShadowController()); | 497 shadow_controller_.reset(new internal::ShadowController()); |
492 } | 498 } |
493 | 499 |
| 500 // Create system_tray_notifier_ before the delegate. |
| 501 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); |
| 502 |
494 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. | 503 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. |
495 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); | 504 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); |
496 if (!system_tray_delegate_.get()) | 505 if (!system_tray_delegate_.get()) |
497 system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate()); | 506 system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate()); |
498 | 507 |
499 // Creates StatusAreaWidget. | 508 // Creates StatusAreaWidget. |
500 root_window_controller->InitForPrimaryDisplay(); | 509 root_window_controller->InitForPrimaryDisplay(); |
501 | 510 |
502 // Initialize system_tray_delegate_ after StatusAreaWidget is created. | 511 // Initialize system_tray_delegate_ after StatusAreaWidget is created. |
503 system_tray_delegate_->Initialize(); | 512 system_tray_delegate_->Initialize(); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 836 |
828 bool Shell::CanAcceptEvents() { | 837 bool Shell::CanAcceptEvents() { |
829 return true; | 838 return true; |
830 } | 839 } |
831 | 840 |
832 ui::EventTarget* Shell::GetParentTarget() { | 841 ui::EventTarget* Shell::GetParentTarget() { |
833 return NULL; | 842 return NULL; |
834 } | 843 } |
835 | 844 |
836 } // namespace ash | 845 } // namespace ash |
OLD | NEW |