OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/wm_shell.h" | 5 #include "ash/common/wm_shell.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
10 #include "ash/common/accelerators/ash_focus_manager_factory.h" | 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" |
11 #include "ash/common/accessibility_delegate.h" | 11 #include "ash/common/accessibility_delegate.h" |
12 #include "ash/common/focus_cycler.h" | 12 #include "ash/common/focus_cycler.h" |
13 #include "ash/common/keyboard/keyboard_ui.h" | 13 #include "ash/common/keyboard/keyboard_ui.h" |
14 #include "ash/common/new_window_delegate.h" | 14 #include "ash/common/new_window_delegate.h" |
15 #include "ash/common/palette_delegate.h" | 15 #include "ash/common/palette_delegate.h" |
16 #include "ash/common/session/session_state_delegate.h" | 16 #include "ash/common/session/session_state_delegate.h" |
17 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | 17 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
18 #include "ash/common/shelf/shelf_delegate.h" | 18 #include "ash/common/shelf/shelf_delegate.h" |
19 #include "ash/common/shelf/shelf_model.h" | 19 #include "ash/common/shelf/shelf_model.h" |
20 #include "ash/common/shelf/shelf_window_watcher.h" | 20 #include "ash/common/shelf/shelf_window_watcher.h" |
21 #include "ash/common/shell_delegate.h" | 21 #include "ash/common/shell_delegate.h" |
22 #include "ash/common/shell_window_ids.h" | 22 #include "ash/common/shell_window_ids.h" |
23 #include "ash/common/system/brightness_control_delegate.h" | 23 #include "ash/common/system/brightness_control_delegate.h" |
24 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 24 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
25 #include "ash/common/system/toast/toast_manager.h" | 25 #include "ash/common/system/toast/toast_manager.h" |
26 #include "ash/common/system/tray/system_tray_delegate.h" | 26 #include "ash/common/system/tray/system_tray_delegate.h" |
27 #include "ash/common/system/tray/system_tray_notifier.h" | 27 #include "ash/common/system/tray/system_tray_notifier.h" |
28 #include "ash/common/wallpaper/wallpaper_controller.h" | |
28 #include "ash/common/wallpaper/wallpaper_delegate.h" | 29 #include "ash/common/wallpaper/wallpaper_delegate.h" |
29 #include "ash/common/wm/immersive_context_ash.h" | 30 #include "ash/common/wm/immersive_context_ash.h" |
30 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 31 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
31 #include "ash/common/wm/mru_window_tracker.h" | 32 #include "ash/common/wm/mru_window_tracker.h" |
32 #include "ash/common/wm/overview/window_selector_controller.h" | 33 #include "ash/common/wm/overview/window_selector_controller.h" |
33 #include "ash/common/wm/window_cycle_controller.h" | 34 #include "ash/common/wm/window_cycle_controller.h" |
34 #include "ash/common/wm_window.h" | 35 #include "ash/common/wm_window.h" |
35 #include "base/bind.h" | 36 #include "base/bind.h" |
36 #include "base/logging.h" | 37 #include "base/logging.h" |
37 #include "base/memory/ptr_util.h" | 38 #include "base/memory/ptr_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 toast_manager_.reset(new ToastManager); | 70 toast_manager_.reset(new ToastManager); |
70 | 71 |
71 // Create the app list item in the shelf data model. | 72 // Create the app list item in the shelf data model. |
72 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); | 73 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); |
73 | 74 |
74 // Install the custom factory early on so that views::FocusManagers for Tray, | 75 // Install the custom factory early on so that views::FocusManagers for Tray, |
75 // Shelf, and WallPaper could be created by the factory. | 76 // Shelf, and WallPaper could be created by the factory. |
76 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 77 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
77 | 78 |
78 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); | 79 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); |
80 | |
81 wallpaper_controller_.reset(new WallpaperController(GetBlockingPool())); | |
79 } | 82 } |
80 | 83 |
81 void WmShell::Shutdown() { | 84 void WmShell::Shutdown() { |
82 // Accesses WmShell in its destructor. | 85 // These members access WmShell in their destructors. |
83 accessibility_delegate_.reset(); | 86 accessibility_delegate_.reset(); |
87 wallpaper_controller_.reset(); | |
James Cook
2016/09/07 21:27:05
nit: destroy before accessibility_delegate unless
msw
2016/09/07 22:28:24
Done.
| |
88 | |
84 // ShelfWindowWatcher has window observers and a pointer to the shelf model. | 89 // ShelfWindowWatcher has window observers and a pointer to the shelf model. |
85 shelf_window_watcher_.reset(); | 90 shelf_window_watcher_.reset(); |
86 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC | 91 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC |
87 // shelf items in Chrome) so explicitly shutdown early. | 92 // shelf items in Chrome) so explicitly shutdown early. |
88 shelf_model_->DestroyItemDelegates(); | 93 shelf_model_->DestroyItemDelegates(); |
89 // Must be destroyed before FocusClient. | 94 // Must be destroyed before FocusClient. |
90 shelf_delegate_.reset(); | 95 shelf_delegate_.reset(); |
91 | 96 |
92 // Balances the Install() in Initialize(). | 97 // Balances the Install() in Initialize(). |
93 views::FocusManagerFactory::Install(nullptr); | 98 views::FocusManagerFactory::Install(nullptr); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 void WmShell::DeleteToastManager() { | 303 void WmShell::DeleteToastManager() { |
299 toast_manager_.reset(); | 304 toast_manager_.reset(); |
300 } | 305 } |
301 | 306 |
302 void WmShell::SetAcceleratorController( | 307 void WmShell::SetAcceleratorController( |
303 std::unique_ptr<AcceleratorController> accelerator_controller) { | 308 std::unique_ptr<AcceleratorController> accelerator_controller) { |
304 accelerator_controller_ = std::move(accelerator_controller); | 309 accelerator_controller_ = std::move(accelerator_controller); |
305 } | 310 } |
306 | 311 |
307 } // namespace ash | 312 } // namespace ash |
OLD | NEW |