Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: ash/common/wm_shell.cc

Issue 2318223003: mash: Migrate wallpaper controllers to ash/common. (Closed)
Patch Set: Fix nit. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/default_wallpaper_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
53 // static 54 // static
54 void WmShell::Set(WmShell* instance) { 55 void WmShell::Set(WmShell* instance) {
55 instance_ = instance; 56 instance_ = instance;
56 } 57 }
57 58
58 // static 59 // static
59 WmShell* WmShell::Get() { 60 WmShell* WmShell::Get() {
60 return instance_; 61 return instance_;
61 } 62 }
62 63
63 void WmShell::Initialize() { 64 void WmShell::Initialize(const scoped_refptr<base::SequencedWorkerPool>& pool) {
65 blocking_pool_ = pool;
66
64 // Some delegates access WmShell during their construction. Create them here 67 // Some delegates access WmShell during their construction. Create them here
65 // instead of the WmShell constructor. 68 // instead of the WmShell constructor.
66 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); 69 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
67 media_delegate_.reset(delegate_->CreateMediaDelegate()); 70 media_delegate_.reset(delegate_->CreateMediaDelegate());
68 palette_delegate_ = delegate_->CreatePaletteDelegate(); 71 palette_delegate_ = delegate_->CreatePaletteDelegate();
69 toast_manager_.reset(new ToastManager); 72 toast_manager_.reset(new ToastManager);
70 73
71 // Create the app list item in the shelf data model. 74 // Create the app list item in the shelf data model.
72 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); 75 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get());
73 76
74 // Install the custom factory early on so that views::FocusManagers for Tray, 77 // Install the custom factory early on so that views::FocusManagers for Tray,
75 // Shelf, and WallPaper could be created by the factory. 78 // Shelf, and WallPaper could be created by the factory.
76 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 79 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
77 80
78 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); 81 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
82
83 wallpaper_controller_.reset(new WallpaperController(blocking_pool_));
79 } 84 }
80 85
81 void WmShell::Shutdown() { 86 void WmShell::Shutdown() {
82 // Accesses WmShell in its destructor. 87 // These members access WmShell in their destructors.
88 wallpaper_controller_.reset();
83 accessibility_delegate_.reset(); 89 accessibility_delegate_.reset();
90
84 // ShelfWindowWatcher has window observers and a pointer to the shelf model. 91 // ShelfWindowWatcher has window observers and a pointer to the shelf model.
85 shelf_window_watcher_.reset(); 92 shelf_window_watcher_.reset();
86 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 93 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
87 // shelf items in Chrome) so explicitly shutdown early. 94 // shelf items in Chrome) so explicitly shutdown early.
88 shelf_model_->DestroyItemDelegates(); 95 shelf_model_->DestroyItemDelegates();
89 // Must be destroyed before FocusClient. 96 // Must be destroyed before FocusClient.
90 shelf_delegate_.reset(); 97 shelf_delegate_.reset();
91 98
92 // Balances the Install() in Initialize(). 99 // Balances the Install() in Initialize().
93 views::FocusManagerFactory::Install(nullptr); 100 views::FocusManagerFactory::Install(nullptr);
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void WmShell::DeleteToastManager() { 305 void WmShell::DeleteToastManager() {
299 toast_manager_.reset(); 306 toast_manager_.reset();
300 } 307 }
301 308
302 void WmShell::SetAcceleratorController( 309 void WmShell::SetAcceleratorController(
303 std::unique_ptr<AcceleratorController> accelerator_controller) { 310 std::unique_ptr<AcceleratorController> accelerator_controller) {
304 accelerator_controller_ = std::move(accelerator_controller); 311 accelerator_controller_ = std::move(accelerator_controller);
305 } 312 }
306 313
307 } // namespace ash 314 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/default_wallpaper_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698