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

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

Issue 2761063002: Move more from WmShell to Shell (Closed)
Patch Set: merge Created 3 years, 9 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/focus_cycler_unittest.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/cast_config_controller.h"
11 #include "ash/common/focus_cycler.h"
12 #include "ash/common/keyboard/keyboard_ui.h"
13 #include "ash/common/media_controller.h" 10 #include "ash/common/media_controller.h"
14 #include "ash/common/new_window_controller.h" 11 #include "ash/common/new_window_controller.h"
15 #include "ash/common/session/session_controller.h" 12 #include "ash/common/session/session_controller.h"
16 #include "ash/common/session/session_state_delegate.h" 13 #include "ash/common/session/session_state_delegate.h"
17 #include "ash/common/shelf/app_list_shelf_item_delegate.h" 14 #include "ash/common/shelf/app_list_shelf_item_delegate.h"
18 #include "ash/common/shelf/shelf_controller.h" 15 #include "ash/common/shelf/shelf_controller.h"
19 #include "ash/common/shelf/shelf_delegate.h" 16 #include "ash/common/shelf/shelf_delegate.h"
20 #include "ash/common/shelf/shelf_model.h" 17 #include "ash/common/shelf/shelf_model.h"
21 #include "ash/common/shelf/shelf_window_watcher.h" 18 #include "ash/common/shelf/shelf_window_watcher.h"
22 #include "ash/common/shell_delegate.h" 19 #include "ash/common/shell_delegate.h"
23 #include "ash/common/shutdown_controller.h" 20 #include "ash/common/shutdown_controller.h"
24 #include "ash/common/system/brightness_control_delegate.h"
25 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h "
26 #include "ash/common/system/chromeos/keyboard_brightness_controller.h"
27 #include "ash/common/system/chromeos/network/vpn_list.h" 21 #include "ash/common/system/chromeos/network/vpn_list.h"
28 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h"
29 #include "ash/common/system/keyboard_brightness_control_delegate.h"
30 #include "ash/common/system/locale/locale_notification_controller.h"
31 #include "ash/common/system/tray/system_tray_controller.h"
32 #include "ash/common/system/tray/system_tray_delegate.h"
33 #include "ash/common/system/tray/system_tray_notifier.h" 22 #include "ash/common/system/tray/system_tray_notifier.h"
34 #include "ash/common/wm/immersive_context_ash.h" 23 #include "ash/common/wm/immersive_context_ash.h"
35 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
36 #include "ash/common/wm/mru_window_tracker.h" 25 #include "ash/common/wm/mru_window_tracker.h"
37 #include "ash/common/wm/overview/window_selector_controller.h" 26 #include "ash/common/wm/overview/window_selector_controller.h"
38 #include "ash/common/wm/root_window_finder.h" 27 #include "ash/common/wm/root_window_finder.h"
39 #include "ash/common/wm/system_modal_container_layout_manager.h" 28 #include "ash/common/wm/system_modal_container_layout_manager.h"
40 #include "ash/common/wm/window_cycle_controller.h" 29 #include "ash/common/wm/window_cycle_controller.h"
41 #include "ash/common/wm_window.h" 30 #include "ash/common/wm_window.h"
42 #include "ash/public/cpp/shell_window_ids.h" 31 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { 125 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) {
137 lock_state_observers_.RemoveObserver(observer); 126 lock_state_observers_.RemoveObserver(observer);
138 } 127 }
139 128
140 void WmShell::SetShelfDelegateForTesting( 129 void WmShell::SetShelfDelegateForTesting(
141 std::unique_ptr<ShelfDelegate> test_delegate) { 130 std::unique_ptr<ShelfDelegate> test_delegate) {
142 shelf_delegate_ = std::move(test_delegate); 131 shelf_delegate_ = std::move(test_delegate);
143 } 132 }
144 133
145 WmShell::WmShell() 134 WmShell::WmShell()
146 : brightness_control_delegate_( 135 : immersive_context_(base::MakeUnique<ImmersiveContextAsh>()),
147 base::MakeUnique<system::BrightnessControllerChromeos>()),
148 cast_config_(base::MakeUnique<CastConfigController>()),
149 focus_cycler_(base::MakeUnique<FocusCycler>()),
150 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()),
151 keyboard_brightness_control_delegate_(
152 base::MakeUnique<KeyboardBrightnessController>()),
153 locale_notification_controller_(
154 base::MakeUnique<LocaleNotificationController>()),
155 media_controller_(base::MakeUnique<MediaController>()), 136 media_controller_(base::MakeUnique<MediaController>()),
156 new_window_controller_(base::MakeUnique<NewWindowController>()), 137 new_window_controller_(base::MakeUnique<NewWindowController>()),
157 session_controller_(base::MakeUnique<SessionController>()), 138 session_controller_(base::MakeUnique<SessionController>()),
158 shelf_controller_(base::MakeUnique<ShelfController>()), 139 shelf_controller_(base::MakeUnique<ShelfController>()),
159 shutdown_controller_(base::MakeUnique<ShutdownController>()), 140 shutdown_controller_(base::MakeUnique<ShutdownController>()),
160 system_tray_controller_(base::MakeUnique<SystemTrayController>()),
161 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), 141 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()),
162 vpn_list_(base::MakeUnique<VpnList>()), 142 vpn_list_(base::MakeUnique<VpnList>()),
163 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), 143 window_cycle_controller_(base::MakeUnique<WindowCycleController>()),
164 window_selector_controller_( 144 window_selector_controller_(
165 base::MakeUnique<WindowSelectorController>()) { 145 base::MakeUnique<WindowSelectorController>()) {
166 DCHECK(!instance_); 146 DCHECK(!instance_);
167 instance_ = this; 147 instance_ = this;
168 session_controller_->AddSessionStateObserver(this); 148 session_controller_->AddSessionStateObserver(this);
169 } 149 }
170 150
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 return; 193 return;
214 } 194 }
215 } 195 }
216 for (WmWindow* root_window : root_windows) { 196 for (WmWindow* root_window : root_windows) {
217 root_window->GetRootWindowController() 197 root_window->GetRootWindowController()
218 ->GetSystemModalLayoutManager(removed) 198 ->GetSystemModalLayoutManager(removed)
219 ->DestroyModalBackground(); 199 ->DestroyModalBackground();
220 } 200 }
221 } 201 }
222 202
223 void WmShell::SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui) {
224 keyboard_ui_ = std::move(keyboard_ui);
225 }
226
227 void WmShell::SetSystemTrayDelegate(
228 std::unique_ptr<SystemTrayDelegate> delegate) {
229 DCHECK(delegate);
230 system_tray_delegate_ = std::move(delegate);
231 system_tray_delegate_->Initialize();
232 // Accesses WmShell in its constructor.
233 logout_confirmation_controller_.reset(new LogoutConfirmationController(
234 base::Bind(&SystemTrayController::SignOut,
235 base::Unretained(system_tray_controller_.get()))));
236 }
237
238 void WmShell::DeleteSystemTrayDelegate() {
239 DCHECK(system_tray_delegate_);
240 // Accesses WmShell in its destructor.
241 logout_confirmation_controller_.reset();
242 system_tray_delegate_.reset();
243 }
244
245 void WmShell::DeleteWindowCycleController() { 203 void WmShell::DeleteWindowCycleController() {
246 window_cycle_controller_.reset(); 204 window_cycle_controller_.reset();
247 } 205 }
248 206
249 void WmShell::DeleteWindowSelectorController() { 207 void WmShell::DeleteWindowSelectorController() {
250 window_selector_controller_.reset(); 208 window_selector_controller_.reset();
251 } 209 }
252 210
253 void WmShell::CreateMaximizeModeController() { 211 void WmShell::CreateMaximizeModeController() {
254 maximize_mode_controller_.reset(new MaximizeModeController); 212 maximize_mode_controller_.reset(new MaximizeModeController);
(...skipping 19 matching lines...) Expand all
274 232
275 // Only trigger an update in mash because with classic ash chrome calls 233 // Only trigger an update in mash because with classic ash chrome calls
276 // UpdateAfterLoginStatusChange() directly. 234 // UpdateAfterLoginStatusChange() directly.
277 if (IsRunningInMash()) { 235 if (IsRunningInMash()) {
278 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too? 236 // TODO(jamescook): Should this call Shell::OnLoginStatusChanged() too?
279 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus()); 237 UpdateAfterLoginStatusChange(session_controller_->GetLoginStatus());
280 } 238 }
281 } 239 }
282 240
283 } // namespace ash 241 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_shell.h ('k') | ash/focus_cycler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698