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

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

Issue 2391253004: Use mojo Shelf interfaces for both mash and classic ash. (Closed)
Patch Set: Address manifest comment; working on test failures/crashes. Created 4 years, 2 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
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"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 blocking_pool_ = pool; 69 blocking_pool_ = pool;
70 70
71 // Some delegates access WmShell during their construction. Create them here 71 // Some delegates access WmShell during their construction. Create them here
72 // instead of the WmShell constructor. 72 // instead of the WmShell constructor.
73 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); 73 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate());
74 media_delegate_.reset(delegate_->CreateMediaDelegate()); 74 media_delegate_.reset(delegate_->CreateMediaDelegate());
75 palette_delegate_ = delegate_->CreatePaletteDelegate(); 75 palette_delegate_ = delegate_->CreatePaletteDelegate();
76 toast_manager_.reset(new ToastManager); 76 toast_manager_.reset(new ToastManager);
77 77
78 // Create the app list item in the shelf data model. 78 // Create the app list item in the shelf data model.
79 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); 79 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model());
80 80
81 // Install the custom factory early on so that views::FocusManagers for Tray, 81 // Install the custom factory early on so that views::FocusManagers for Tray,
82 // Shelf, and WallPaper could be created by the factory. 82 // Shelf, and WallPaper could be created by the factory.
83 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 83 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
84 84
85 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); 85 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate());
86 86
87 wallpaper_controller_.reset(new WallpaperController(blocking_pool_)); 87 wallpaper_controller_.reset(new WallpaperController(blocking_pool_));
88 } 88 }
89 89
90 void WmShell::Shutdown() { 90 void WmShell::Shutdown() {
91 // These members access WmShell in their destructors. 91 // These members access WmShell in their destructors.
92 wallpaper_controller_.reset(); 92 wallpaper_controller_.reset();
93 accessibility_delegate_.reset(); 93 accessibility_delegate_.reset();
94 94
95 // ShelfWindowWatcher has window observers and a pointer to the shelf model. 95 // ShelfWindowWatcher has window observers and a pointer to the shelf model.
96 shelf_window_watcher_.reset(); 96 shelf_window_watcher_.reset();
97 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 97 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
98 // shelf items in Chrome) so explicitly shutdown early. 98 // shelf items in Chrome) so explicitly shutdown early.
99 shelf_model_->DestroyItemDelegates(); 99 shelf_model()->DestroyItemDelegates();
100 // Must be destroyed before FocusClient. 100 // Must be destroyed before FocusClient.
101 shelf_delegate_.reset(); 101 shelf_delegate_.reset();
102 102
103 // Balances the Install() in Initialize(). 103 // Balances the Install() in Initialize().
104 views::FocusManagerFactory::Install(nullptr); 104 views::FocusManagerFactory::Install(nullptr);
105 } 105 }
106 106
107 void WmShell::ShowContextMenu(const gfx::Point& location_in_screen, 107 void WmShell::ShowContextMenu(const gfx::Point& location_in_screen,
108 ui::MenuSourceType source_type) { 108 ui::MenuSourceType source_type) {
109 // Bail if there is no active user session or if the screen is locked. 109 // Bail if there is no active user session or if the screen is locked.
(...skipping 24 matching lines...) Expand all
134 134
135 void WmShell::CreateShelfDelegate() { 135 void WmShell::CreateShelfDelegate() {
136 // May be called multiple times as shelves are created and destroyed. 136 // May be called multiple times as shelves are created and destroyed.
137 if (shelf_delegate_) 137 if (shelf_delegate_)
138 return; 138 return;
139 // Must occur after SessionStateDelegate creation and user login because 139 // Must occur after SessionStateDelegate creation and user login because
140 // Chrome's implementation of ShelfDelegate assumes it can get information 140 // Chrome's implementation of ShelfDelegate assumes it can get information
141 // about multi-profile login state. 141 // about multi-profile login state.
142 DCHECK(GetSessionStateDelegate()); 142 DCHECK(GetSessionStateDelegate());
143 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); 143 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0);
144 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); 144 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model()));
145 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model_.get())); 145 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model()));
146 } 146 }
147 147
148 void WmShell::OnMaximizeModeStarted() { 148 void WmShell::OnMaximizeModeStarted() {
149 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); 149 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted());
150 } 150 }
151 151
152 void WmShell::OnMaximizeModeEnded() { 152 void WmShell::OnMaximizeModeEnded() {
153 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); 153 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded());
154 } 154 }
155 155
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 shelf_delegate_ = std::move(test_delegate); 217 shelf_delegate_ = std::move(test_delegate);
218 } 218 }
219 219
220 void WmShell::SetPaletteDelegateForTesting( 220 void WmShell::SetPaletteDelegateForTesting(
221 std::unique_ptr<PaletteDelegate> palette_delegate) { 221 std::unique_ptr<PaletteDelegate> palette_delegate) {
222 palette_delegate_ = std::move(palette_delegate); 222 palette_delegate_ = std::move(palette_delegate);
223 } 223 }
224 224
225 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) 225 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate)
226 : delegate_(std::move(shell_delegate)), 226 : delegate_(std::move(shell_delegate)),
227 focus_cycler_(new FocusCycler), 227 focus_cycler_(base::MakeUnique<FocusCycler>()),
228 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), 228 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()),
229 shelf_model_(new ShelfModel), // Must create before ShelfDelegate. 229 shelf_controller_(base::MakeUnique<ShelfController>()),
230 system_tray_controller_( 230 system_tray_controller_(base::MakeUnique<SystemTrayController>(
231 new SystemTrayController(delegate_->GetShellConnector())), 231 delegate_->GetShellConnector())),
232 system_tray_notifier_(new SystemTrayNotifier), 232 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()),
233 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()), 233 wallpaper_delegate_(delegate_->CreateWallpaperDelegate()),
234 window_cycle_controller_(new WindowCycleController), 234 window_cycle_controller_(base::MakeUnique<WindowCycleController>()),
235 window_selector_controller_(new WindowSelectorController) { 235 window_selector_controller_(
236 base::MakeUnique<WindowSelectorController>()) {
236 #if defined(OS_CHROMEOS) 237 #if defined(OS_CHROMEOS)
237 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); 238 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos);
238 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); 239 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController);
239 #endif 240 #endif
240 } 241 }
241 242
242 WmShell::~WmShell() {} 243 WmShell::~WmShell() {}
243 244
244 WmRootWindowController* WmShell::GetPrimaryRootWindowController() { 245 WmRootWindowController* WmShell::GetPrimaryRootWindowController() {
245 return GetPrimaryRootWindow()->GetRootWindowController(); 246 return GetPrimaryRootWindow()->GetRootWindowController();
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 void WmShell::DeleteToastManager() { 375 void WmShell::DeleteToastManager() {
375 toast_manager_.reset(); 376 toast_manager_.reset();
376 } 377 }
377 378
378 void WmShell::SetAcceleratorController( 379 void WmShell::SetAcceleratorController(
379 std::unique_ptr<AcceleratorController> accelerator_controller) { 380 std::unique_ptr<AcceleratorController> accelerator_controller) {
380 accelerator_controller_ = std::move(accelerator_controller); 381 accelerator_controller_ = std::move(accelerator_controller);
381 } 382 }
382 383
383 } // namespace ash 384 } // namespace ash
OLDNEW
« ash/common/wm_shell.h ('K') | « ash/common/wm_shell.h ('k') | ash/mus/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698