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

Side by Side Diff: ash/shell.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: cleanup Created 3 years, 8 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 (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 #include <utility> 9 #include <utility>
10 10
11 #include "ash/accelerators/accelerator_controller.h" 11 #include "ash/accelerators/accelerator_controller.h"
12 #include "ash/accelerators/accelerator_delegate.h" 12 #include "ash/accelerators/accelerator_delegate.h"
13 #include "ash/accelerators/ash_focus_manager_factory.h" 13 #include "ash/accelerators/ash_focus_manager_factory.h"
14 #include "ash/accelerators/magnifier_key_scroller.h" 14 #include "ash/accelerators/magnifier_key_scroller.h"
15 #include "ash/accelerators/spoken_feedback_toggler.h" 15 #include "ash/accelerators/spoken_feedback_toggler.h"
16 #include "ash/accessibility_delegate.h" 16 #include "ash/accessibility_delegate.h"
17 #include "ash/app_list/app_list_delegate_impl.h" 17 #include "ash/app_list/app_list_delegate_impl.h"
18 #include "ash/ash_constants.h" 18 #include "ash/ash_constants.h"
19 #include "ash/aura/wm_shell_aura.h" 19 #include "ash/aura/shell_port_classic.h"
20 #include "ash/autoclick/autoclick_controller.h" 20 #include "ash/autoclick/autoclick_controller.h"
21 #include "ash/cast_config_controller.h" 21 #include "ash/cast_config_controller.h"
22 #include "ash/devtools/ash_devtools_css_agent.h" 22 #include "ash/devtools/ash_devtools_css_agent.h"
23 #include "ash/devtools/ash_devtools_dom_agent.h" 23 #include "ash/devtools/ash_devtools_dom_agent.h"
24 #include "ash/display/cursor_window_controller.h" 24 #include "ash/display/cursor_window_controller.h"
25 #include "ash/display/display_color_manager_chromeos.h" 25 #include "ash/display/display_color_manager_chromeos.h"
26 #include "ash/display/display_configuration_controller.h" 26 #include "ash/display/display_configuration_controller.h"
27 #include "ash/display/display_error_observer_chromeos.h" 27 #include "ash/display/display_error_observer_chromeos.h"
28 #include "ash/display/event_transformation_handler.h" 28 #include "ash/display/event_transformation_handler.h"
29 #include "ash/display/mouse_cursor_event_filter.h" 29 #include "ash/display/mouse_cursor_event_filter.h"
(...skipping 25 matching lines...) Expand all
55 #include "ash/session/session_controller.h" 55 #include "ash/session/session_controller.h"
56 #include "ash/session/session_state_delegate.h" 56 #include "ash/session/session_state_delegate.h"
57 #include "ash/shelf/shelf_controller.h" 57 #include "ash/shelf/shelf_controller.h"
58 #include "ash/shelf/shelf_delegate.h" 58 #include "ash/shelf/shelf_delegate.h"
59 #include "ash/shelf/shelf_model.h" 59 #include "ash/shelf/shelf_model.h"
60 #include "ash/shelf/shelf_window_watcher.h" 60 #include "ash/shelf/shelf_window_watcher.h"
61 #include "ash/shelf/wm_shelf.h" 61 #include "ash/shelf/wm_shelf.h"
62 #include "ash/shell_delegate.h" 62 #include "ash/shell_delegate.h"
63 #include "ash/shell_init_params.h" 63 #include "ash/shell_init_params.h"
64 #include "ash/shell_observer.h" 64 #include "ash/shell_observer.h"
65 #include "ash/shell_port.h"
65 #include "ash/shutdown_controller.h" 66 #include "ash/shutdown_controller.h"
66 #include "ash/sticky_keys/sticky_keys_controller.h" 67 #include "ash/sticky_keys/sticky_keys_controller.h"
67 #include "ash/system/bluetooth/bluetooth_notification_controller.h" 68 #include "ash/system/bluetooth/bluetooth_notification_controller.h"
68 #include "ash/system/bluetooth/tray_bluetooth_helper.h" 69 #include "ash/system/bluetooth/tray_bluetooth_helper.h"
69 #include "ash/system/brightness/brightness_controller_chromeos.h" 70 #include "ash/system/brightness/brightness_controller_chromeos.h"
70 #include "ash/system/brightness_control_delegate.h" 71 #include "ash/system/brightness_control_delegate.h"
71 #include "ash/system/keyboard_brightness_control_delegate.h" 72 #include "ash/system/keyboard_brightness_control_delegate.h"
72 #include "ash/system/keyboard_brightness_controller.h" 73 #include "ash/system/keyboard_brightness_controller.h"
73 #include "ash/system/locale/locale_notification_controller.h" 74 #include "ash/system/locale/locale_notification_controller.h"
74 #include "ash/system/network/sms_observer.h" 75 #include "ash/system/network/sms_observer.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "ash/wm/system_modal_container_event_filter.h" 110 #include "ash/wm/system_modal_container_event_filter.h"
110 #include "ash/wm/system_modal_container_layout_manager.h" 111 #include "ash/wm/system_modal_container_layout_manager.h"
111 #include "ash/wm/toplevel_window_event_handler.h" 112 #include "ash/wm/toplevel_window_event_handler.h"
112 #include "ash/wm/video_detector.h" 113 #include "ash/wm/video_detector.h"
113 #include "ash/wm/window_animations.h" 114 #include "ash/wm/window_animations.h"
114 #include "ash/wm/window_cycle_controller.h" 115 #include "ash/wm/window_cycle_controller.h"
115 #include "ash/wm/window_positioner.h" 116 #include "ash/wm/window_positioner.h"
116 #include "ash/wm/window_properties.h" 117 #include "ash/wm/window_properties.h"
117 #include "ash/wm/window_util.h" 118 #include "ash/wm/window_util.h"
118 #include "ash/wm/workspace_controller.h" 119 #include "ash/wm/workspace_controller.h"
119 #include "ash/wm_shell.h"
120 #include "ash/wm_window.h" 120 #include "ash/wm_window.h"
121 #include "base/bind.h" 121 #include "base/bind.h"
122 #include "base/bind_helpers.h" 122 #include "base/bind_helpers.h"
123 #include "base/command_line.h" 123 #include "base/command_line.h"
124 #include "base/memory/ptr_util.h" 124 #include "base/memory/ptr_util.h"
125 #include "base/sys_info.h" 125 #include "base/sys_info.h"
126 #include "base/threading/sequenced_worker_pool.h" 126 #include "base/threading/sequenced_worker_pool.h"
127 #include "base/trace_event/trace_event.h" 127 #include "base/trace_event/trace_event.h"
128 #include "chromeos/audio/audio_a11y_controller.h" 128 #include "chromeos/audio/audio_a11y_controller.h"
129 #include "chromeos/chromeos_switches.h" 129 #include "chromeos/chromeos_switches.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 aura::WindowManagerClient* Shell::window_manager_client_ = nullptr; 215 aura::WindowManagerClient* Shell::window_manager_client_ = nullptr;
216 // static 216 // static
217 bool Shell::initially_hide_cursor_ = false; 217 bool Shell::initially_hide_cursor_ = false;
218 218
219 //////////////////////////////////////////////////////////////////////////////// 219 ////////////////////////////////////////////////////////////////////////////////
220 // Shell, public: 220 // Shell, public:
221 221
222 // static 222 // static
223 Shell* Shell::CreateInstance(const ShellInitParams& init_params) { 223 Shell* Shell::CreateInstance(const ShellInitParams& init_params) {
224 CHECK(!instance_); 224 CHECK(!instance_);
225 WmShell* wm_shell = init_params.wm_shell; 225 ShellPort* shell_port = init_params.shell_port;
226 if (!wm_shell) 226 if (!shell_port)
227 wm_shell = new WmShellAura(); 227 shell_port = new ShellPortClassic();
228 instance_ = new Shell(base::WrapUnique<ShellDelegate>(init_params.delegate), 228 instance_ = new Shell(base::WrapUnique<ShellDelegate>(init_params.delegate),
229 base::WrapUnique<WmShell>(wm_shell)); 229 base::WrapUnique<ShellPort>(shell_port));
230 instance_->Init(init_params); 230 instance_->Init(init_params);
231 return instance_; 231 return instance_;
232 } 232 }
233 233
234 // static 234 // static
235 Shell* Shell::Get() { 235 Shell* Shell::Get() {
236 CHECK(instance_); 236 CHECK(instance_);
237 return instance_; 237 return instance_;
238 } 238 }
239 239
(...skipping 10 matching lines...) Expand all
250 // static 250 // static
251 RootWindowController* Shell::GetPrimaryRootWindowController() { 251 RootWindowController* Shell::GetPrimaryRootWindowController() {
252 CHECK(HasInstance()); 252 CHECK(HasInstance());
253 return GetRootWindowController(GetPrimaryRootWindow()); 253 return GetRootWindowController(GetPrimaryRootWindow());
254 } 254 }
255 255
256 // static 256 // static
257 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { 257 Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() {
258 CHECK(HasInstance()); 258 CHECK(HasInstance());
259 RootWindowControllerList root_window_controllers; 259 RootWindowControllerList root_window_controllers;
260 for (WmWindow* root_window : instance_->wm_shell_->GetAllRootWindows()) 260 for (WmWindow* root_window : instance_->shell_port_->GetAllRootWindows())
261 root_window_controllers.push_back(root_window->GetRootWindowController()); 261 root_window_controllers.push_back(root_window->GetRootWindowController());
262 return root_window_controllers; 262 return root_window_controllers;
263 } 263 }
264 264
265 // static 265 // static
266 RootWindowController* Shell::GetRootWindowControllerWithDisplayId( 266 RootWindowController* Shell::GetRootWindowControllerWithDisplayId(
267 int64_t display_id) { 267 int64_t display_id) {
268 CHECK(HasInstance()); 268 CHECK(HasInstance());
269 WmWindow* root_window = 269 WmWindow* root_window =
270 instance_->wm_shell_->GetRootWindowForDisplayId(display_id); 270 instance_->shell_port_->GetRootWindowForDisplayId(display_id);
271 return root_window ? root_window->GetRootWindowController() : nullptr; 271 return root_window ? root_window->GetRootWindowController() : nullptr;
272 } 272 }
273 273
274 // static 274 // static
275 aura::Window* Shell::GetPrimaryRootWindow() { 275 aura::Window* Shell::GetPrimaryRootWindow() {
276 CHECK(HasInstance()); 276 CHECK(HasInstance());
277 return instance_->wm_shell_->GetPrimaryRootWindow()->aura_window(); 277 return instance_->shell_port_->GetPrimaryRootWindow()->aura_window();
278 } 278 }
279 279
280 // static 280 // static
281 aura::Window* Shell::GetRootWindowForNewWindows() { 281 aura::Window* Shell::GetRootWindowForNewWindows() {
282 CHECK(Shell::HasInstance()); 282 CHECK(Shell::HasInstance());
283 return WmWindow::GetAuraWindow(Shell::GetWmRootWindowForNewWindows()); 283 return WmWindow::GetAuraWindow(Shell::GetWmRootWindowForNewWindows());
284 } 284 }
285 285
286 // static 286 // static
287 WmWindow* Shell::GetWmRootWindowForNewWindows() { 287 WmWindow* Shell::GetWmRootWindowForNewWindows() {
288 CHECK(Shell::HasInstance()); 288 CHECK(Shell::HasInstance());
289 Shell* shell = Shell::Get(); 289 Shell* shell = Shell::Get();
290 if (shell->scoped_root_window_for_new_windows_) 290 if (shell->scoped_root_window_for_new_windows_)
291 return shell->scoped_root_window_for_new_windows_; 291 return shell->scoped_root_window_for_new_windows_;
292 return shell->root_window_for_new_windows_; 292 return shell->root_window_for_new_windows_;
293 } 293 }
294 294
295 // static 295 // static
296 aura::Window::Windows Shell::GetAllRootWindows() { 296 aura::Window::Windows Shell::GetAllRootWindows() {
297 CHECK(HasInstance()); 297 CHECK(HasInstance());
298 aura::Window::Windows windows; 298 aura::Window::Windows windows;
299 for (WmWindow* window : instance_->wm_shell_->GetAllRootWindows()) 299 for (WmWindow* window : instance_->shell_port_->GetAllRootWindows())
300 windows.push_back(window->aura_window()); 300 windows.push_back(window->aura_window());
301 return windows; 301 return windows;
302 } 302 }
303 303
304 // static 304 // static
305 aura::Window* Shell::GetContainer(aura::Window* root_window, int container_id) { 305 aura::Window* Shell::GetContainer(aura::Window* root_window, int container_id) {
306 return root_window->GetChildById(container_id); 306 return root_window->GetChildById(container_id);
307 } 307 }
308 308
309 // static 309 // static
310 const aura::Window* Shell::GetContainer(const aura::Window* root_window, 310 const aura::Window* Shell::GetContainer(const aura::Window* root_window,
311 int container_id) { 311 int container_id) {
312 return root_window->GetChildById(container_id); 312 return root_window->GetChildById(container_id);
313 } 313 }
314 314
315 // static 315 // static
316 Config Shell::GetAshConfig() { 316 Config Shell::GetAshConfig() {
317 return Get()->wm_shell_->GetAshConfig(); 317 return Get()->shell_port_->GetAshConfig();
318 } 318 }
319 319
320 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView( 320 views::NonClientFrameView* Shell::CreateDefaultNonClientFrameView(
321 views::Widget* widget) { 321 views::Widget* widget) {
322 // Use translucent-style window frames for dialogs. 322 // Use translucent-style window frames for dialogs.
323 return new CustomFrameViewAsh(widget); 323 return new CustomFrameViewAsh(widget);
324 } 324 }
325 325
326 void Shell::SetDisplayWorkAreaInsets(Window* contains, 326 void Shell::SetDisplayWorkAreaInsets(Window* contains,
327 const gfx::Insets& insets) { 327 const gfx::Insets& insets) {
328 wm_shell_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets); 328 shell_port_->SetDisplayWorkAreaInsets(WmWindow::Get(contains), insets);
329 } 329 }
330 330
331 void Shell::OnAppTerminating() { 331 void Shell::OnAppTerminating() {
332 for (auto& observer : shell_observers_) 332 for (auto& observer : shell_observers_)
333 observer.OnAppTerminating(); 333 observer.OnAppTerminating();
334 } 334 }
335 335
336 void Shell::OnLockStateChanged(bool locked) { 336 void Shell::OnLockStateChanged(bool locked) {
337 for (auto& observer : shell_observers_) 337 for (auto& observer : shell_observers_)
338 observer.OnLockStateChanged(locked); 338 observer.OnLockStateChanged(locked);
(...skipping 18 matching lines...) Expand all
357 observer.OnRootWindowAdded(root_window); 357 observer.OnRootWindowAdded(root_window);
358 } 358 }
359 359
360 void Shell::CreateKeyboard() { 360 void Shell::CreateKeyboard() {
361 InitKeyboard(); 361 InitKeyboard();
362 GetPrimaryRootWindowController()->ActivateKeyboard( 362 GetPrimaryRootWindowController()->ActivateKeyboard(
363 keyboard::KeyboardController::GetInstance()); 363 keyboard::KeyboardController::GetInstance());
364 } 364 }
365 365
366 void Shell::DeactivateKeyboard() { 366 void Shell::DeactivateKeyboard() {
367 // TODO(jamescook): Move keyboard create and hide into WmShell. 367 // TODO(jamescook): Move keyboard create and hide into ShellPort.
368 keyboard_ui_->Hide(); 368 keyboard_ui_->Hide();
369 if (keyboard::KeyboardController::GetInstance()) { 369 if (keyboard::KeyboardController::GetInstance()) {
370 RootWindowControllerList controllers = GetAllRootWindowControllers(); 370 RootWindowControllerList controllers = GetAllRootWindowControllers();
371 for (RootWindowControllerList::iterator iter = controllers.begin(); 371 for (RootWindowControllerList::iterator iter = controllers.begin();
372 iter != controllers.end(); ++iter) { 372 iter != controllers.end(); ++iter) {
373 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); 373 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance());
374 } 374 }
375 } 375 }
376 keyboard::KeyboardController::ResetInstance(nullptr); 376 keyboard::KeyboardController::ResetInstance(nullptr);
377 } 377 }
378 378
379 bool Shell::ShouldSaveDisplaySettings() { 379 bool Shell::ShouldSaveDisplaySettings() {
380 DCHECK(!wm_shell_->IsRunningInMash()); 380 DCHECK(!shell_port_->IsRunningInMash());
381 return !( 381 return !(
382 screen_orientation_controller_->ignore_display_configuration_updates() || 382 screen_orientation_controller_->ignore_display_configuration_updates() ||
383 resolution_notification_controller_->DoesNotificationTimeout()); 383 resolution_notification_controller_->DoesNotificationTimeout());
384 } 384 }
385 385
386 ShelfModel* Shell::shelf_model() { 386 ShelfModel* Shell::shelf_model() {
387 return shelf_controller_->model(); 387 return shelf_controller_->model();
388 } 388 }
389 389
390 aura::client::ActivationClient* Shell::activation_client() { 390 aura::client::ActivationClient* Shell::activation_client() {
391 return focus_controller_.get(); 391 return focus_controller_.get();
392 } 392 }
393 393
394 void Shell::UpdateShelfVisibility() { 394 void Shell::UpdateShelfVisibility() {
395 for (WmWindow* root : wm_shell_->GetAllRootWindows()) 395 for (WmWindow* root : shell_port_->GetAllRootWindows())
396 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState(); 396 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState();
397 } 397 }
398 398
399 WebNotificationTray* Shell::GetWebNotificationTray() { 399 WebNotificationTray* Shell::GetWebNotificationTray() {
400 return GetPrimaryRootWindowController() 400 return GetPrimaryRootWindowController()
401 ->GetStatusAreaWidget() 401 ->GetStatusAreaWidget()
402 ->web_notification_tray(); 402 ->web_notification_tray();
403 } 403 }
404 404
405 bool Shell::HasPrimaryStatusArea() { 405 bool Shell::HasPrimaryStatusArea() {
(...skipping 16 matching lines...) Expand all
422 FirstRunHelper* Shell::CreateFirstRunHelper() { 422 FirstRunHelper* Shell::CreateFirstRunHelper() {
423 return new FirstRunHelperImpl; 423 return new FirstRunHelperImpl;
424 } 424 }
425 425
426 void Shell::CreateShelfView() { 426 void Shell::CreateShelfView() {
427 // Must occur after SessionController creation and user login. 427 // Must occur after SessionController creation and user login.
428 DCHECK(session_controller()); 428 DCHECK(session_controller());
429 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); 429 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0);
430 CreateShelfDelegate(); 430 CreateShelfDelegate();
431 431
432 for (WmWindow* root_window : wm_shell_->GetAllRootWindows()) 432 for (WmWindow* root_window : shell_port_->GetAllRootWindows())
433 root_window->GetRootWindowController()->CreateShelfView(); 433 root_window->GetRootWindowController()->CreateShelfView();
434 } 434 }
435 435
436 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { 436 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) {
437 window_tree_host_manager_->cursor_window_controller() 437 window_tree_host_manager_->cursor_window_controller()
438 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); 438 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip);
439 } 439 }
440 440
441 void Shell::SetCursorCompositingEnabled(bool enabled) { 441 void Shell::SetCursorCompositingEnabled(bool enabled) {
442 if (GetAshConfig() == Config::CLASSIC) { 442 if (GetAshConfig() == Config::CLASSIC) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 bool Shell::IsAppListVisible() const { 480 bool Shell::IsAppListVisible() const {
481 return app_list_->IsVisible(); 481 return app_list_->IsVisible();
482 } 482 }
483 483
484 bool Shell::GetAppListTargetVisibility() const { 484 bool Shell::GetAppListTargetVisibility() const {
485 return app_list_->GetTargetVisibility(); 485 return app_list_->GetTargetVisibility();
486 } 486 }
487 487
488 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { 488 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) {
489 for (WmWindow* root_window : wm_shell_->GetAllRootWindows()) { 489 for (WmWindow* root_window : shell_port_->GetAllRootWindows()) {
490 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( 490 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange(
491 status); 491 status);
492 } 492 }
493 } 493 }
494 494
495 void Shell::NotifyMaximizeModeStarted() { 495 void Shell::NotifyMaximizeModeStarted() {
496 for (auto& observer : shell_observers_) 496 for (auto& observer : shell_observers_)
497 observer.OnMaximizeModeStarted(); 497 observer.OnMaximizeModeStarted();
498 } 498 }
499 499
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 void Shell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) { 547 void Shell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) {
548 for (auto& observer : shell_observers_) 548 for (auto& observer : shell_observers_)
549 observer.OnShelfAutoHideBehaviorChanged(root_window); 549 observer.OnShelfAutoHideBehaviorChanged(root_window);
550 } 550 }
551 551
552 //////////////////////////////////////////////////////////////////////////////// 552 ////////////////////////////////////////////////////////////////////////////////
553 // Shell, private: 553 // Shell, private:
554 554
555 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, 555 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate,
556 std::unique_ptr<WmShell> wm_shell) 556 std::unique_ptr<ShellPort> shell_port)
557 : wm_shell_(std::move(wm_shell)), 557 : shell_port_(std::move(shell_port)),
558 brightness_control_delegate_( 558 brightness_control_delegate_(
559 base::MakeUnique<system::BrightnessControllerChromeos>()), 559 base::MakeUnique<system::BrightnessControllerChromeos>()),
560 cast_config_(base::MakeUnique<CastConfigController>()), 560 cast_config_(base::MakeUnique<CastConfigController>()),
561 focus_cycler_(base::MakeUnique<FocusCycler>()), 561 focus_cycler_(base::MakeUnique<FocusCycler>()),
562 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), 562 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()),
563 keyboard_brightness_control_delegate_( 563 keyboard_brightness_control_delegate_(
564 base::MakeUnique<KeyboardBrightnessController>()), 564 base::MakeUnique<KeyboardBrightnessController>()),
565 locale_notification_controller_( 565 locale_notification_controller_(
566 base::MakeUnique<LocaleNotificationController>()), 566 base::MakeUnique<LocaleNotificationController>()),
567 media_controller_(base::MakeUnique<MediaController>()), 567 media_controller_(base::MakeUnique<MediaController>()),
568 new_window_controller_(base::MakeUnique<NewWindowController>()), 568 new_window_controller_(base::MakeUnique<NewWindowController>()),
569 session_controller_(base::MakeUnique<SessionController>()), 569 session_controller_(base::MakeUnique<SessionController>()),
570 shelf_controller_(base::MakeUnique<ShelfController>()), 570 shelf_controller_(base::MakeUnique<ShelfController>()),
571 shell_delegate_(std::move(shell_delegate)), 571 shell_delegate_(std::move(shell_delegate)),
572 shutdown_controller_(base::MakeUnique<ShutdownController>()), 572 shutdown_controller_(base::MakeUnique<ShutdownController>()),
573 system_tray_controller_(base::MakeUnique<SystemTrayController>()), 573 system_tray_controller_(base::MakeUnique<SystemTrayController>()),
574 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), 574 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()),
575 vpn_list_(base::MakeUnique<VpnList>()), 575 vpn_list_(base::MakeUnique<VpnList>()),
576 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), 576 window_cycle_controller_(base::MakeUnique<WindowCycleController>()),
577 window_selector_controller_(base::MakeUnique<WindowSelectorController>()), 577 window_selector_controller_(base::MakeUnique<WindowSelectorController>()),
578 app_list_(base::MakeUnique<app_list::AppList>()), 578 app_list_(base::MakeUnique<app_list::AppList>()),
579 link_handler_model_factory_(nullptr), 579 link_handler_model_factory_(nullptr),
580 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), 580 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()),
581 display_configurator_(new display::DisplayConfigurator()), 581 display_configurator_(new display::DisplayConfigurator()),
582 native_cursor_manager_(nullptr), 582 native_cursor_manager_(nullptr),
583 simulate_modal_window_open_for_testing_(false), 583 simulate_modal_window_open_for_testing_(false),
584 is_touch_hud_projection_enabled_(false) { 584 is_touch_hud_projection_enabled_(false) {
585 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash 585 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash
586 // state on WmShellAura. http://crbug.com/671246. 586 // state on ShellPortClassic. http://crbug.com/671246.
587 587
588 if (!wm_shell_->IsRunningInMash()) { 588 if (!shell_port_->IsRunningInMash()) {
589 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); 589 gpu_support_.reset(shell_delegate_->CreateGPUSupport());
590 display_manager_.reset(ScreenAsh::CreateDisplayManager()); 590 display_manager_.reset(ScreenAsh::CreateDisplayManager());
591 window_tree_host_manager_.reset(new WindowTreeHostManager); 591 window_tree_host_manager_.reset(new WindowTreeHostManager);
592 user_metrics_recorder_.reset(new UserMetricsRecorder); 592 user_metrics_recorder_.reset(new UserMetricsRecorder);
593 } 593 }
594 594
595 PowerStatus::Initialize(); 595 PowerStatus::Initialize();
596 596
597 session_controller_->AddSessionStateObserver(this); 597 session_controller_->AddSessionStateObserver(this);
598 } 598 }
599 599
600 Shell::~Shell() { 600 Shell::~Shell() {
601 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); 601 TRACE_EVENT0("shutdown", "ash::Shell::Destructor");
602 602
603 const Config config = wm_shell_->GetAshConfig(); 603 const Config config = shell_port_->GetAshConfig();
604 604
605 if (config != Config::MASH) 605 if (config != Config::MASH)
606 user_metrics_recorder_->OnShellShuttingDown(); 606 user_metrics_recorder_->OnShellShuttingDown();
607 607
608 shell_delegate_->PreShutdown(); 608 shell_delegate_->PreShutdown();
609 609
610 // Remove the focus from any window. This will prevent overhead and side 610 // Remove the focus from any window. This will prevent overhead and side
611 // effects (e.g. crashes) from changing focus during shutdown. 611 // effects (e.g. crashes) from changing focus during shutdown.
612 // See bug crbug.com/134502. 612 // See bug crbug.com/134502.
613 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); 613 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 maximize_mode_controller_.reset(); 653 maximize_mode_controller_.reset();
654 654
655 // Destroy the keyboard before closing the shelf, since it will invoke a shelf 655 // Destroy the keyboard before closing the shelf, since it will invoke a shelf
656 // layout. 656 // layout.
657 DeactivateKeyboard(); 657 DeactivateKeyboard();
658 658
659 toast_manager_.reset(); 659 toast_manager_.reset();
660 660
661 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure 661 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure
662 // to deinitialize the shelf first, as it is initialized after the delegate. 662 // to deinitialize the shelf first, as it is initialized after the delegate.
663 for (WmWindow* root : wm_shell_->GetAllRootWindows()) 663 for (WmWindow* root : shell_port_->GetAllRootWindows())
664 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); 664 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget();
665 tray_bluetooth_helper_.reset(); 665 tray_bluetooth_helper_.reset();
666 DeleteSystemTrayDelegate(); 666 DeleteSystemTrayDelegate();
667 667
668 // Drag-and-drop must be canceled prior to close all windows. 668 // Drag-and-drop must be canceled prior to close all windows.
669 drag_drop_controller_.reset(); 669 drag_drop_controller_.reset();
670 670
671 // Controllers who have WindowObserver added must be deleted 671 // Controllers who have WindowObserver added must be deleted
672 // before |window_tree_host_manager_| is deleted. 672 // before |window_tree_host_manager_| is deleted.
673 673
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC 739 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC
740 // shelf items in Chrome) so explicitly shutdown early. 740 // shelf items in Chrome) so explicitly shutdown early.
741 shelf_model()->DestroyItemDelegates(); 741 shelf_model()->DestroyItemDelegates();
742 742
743 // Must be destroyed before FocusController. 743 // Must be destroyed before FocusController.
744 shelf_delegate_.reset(); 744 shelf_delegate_.reset();
745 745
746 // Removes itself as an observer of |pref_service_|. 746 // Removes itself as an observer of |pref_service_|.
747 shelf_controller_.reset(); 747 shelf_controller_.reset();
748 748
749 wm_shell_->Shutdown(); 749 shell_port_->Shutdown();
750 750
751 // Depends on |focus_controller_|, so must be destroyed before. 751 // Depends on |focus_controller_|, so must be destroyed before.
752 window_tree_host_manager_.reset(); 752 window_tree_host_manager_.reset();
753 focus_controller_->RemoveObserver(this); 753 focus_controller_->RemoveObserver(this);
754 focus_controller_.reset(); 754 focus_controller_.reset();
755 screen_position_controller_.reset(); 755 screen_position_controller_.reset();
756 756
757 display_color_manager_.reset(); 757 display_color_manager_.reset();
758 if (display_change_observer_) 758 if (display_change_observer_)
759 display_configurator_->RemoveObserver(display_change_observer_.get()); 759 display_configurator_->RemoveObserver(display_change_observer_.get());
760 if (display_error_observer_) 760 if (display_error_observer_)
761 display_configurator_->RemoveObserver(display_error_observer_.get()); 761 display_configurator_->RemoveObserver(display_error_observer_.get());
762 if (projecting_observer_) { 762 if (projecting_observer_) {
763 display_configurator_->RemoveObserver(projecting_observer_.get()); 763 display_configurator_->RemoveObserver(projecting_observer_.get());
764 RemoveShellObserver(projecting_observer_.get()); 764 RemoveShellObserver(projecting_observer_.get());
765 } 765 }
766 display_change_observer_.reset(); 766 display_change_observer_.reset();
767 shutdown_observer_.reset(); 767 shutdown_observer_.reset();
768 768
769 PowerStatus::Shutdown(); 769 PowerStatus::Shutdown();
770 770
771 // Ensure that DBusThreadManager outlives this Shell. 771 // Ensure that DBusThreadManager outlives this Shell.
772 DCHECK(chromeos::DBusThreadManager::IsInitialized()); 772 DCHECK(chromeos::DBusThreadManager::IsInitialized());
773 773
774 // Needs to happen right before |instance_| is reset. 774 // Needs to happen right before |instance_| is reset.
775 wm_shell_.reset(); 775 shell_port_.reset();
776 session_controller_->RemoveSessionStateObserver(this); 776 session_controller_->RemoveSessionStateObserver(this);
777 wallpaper_delegate_.reset(); 777 wallpaper_delegate_.reset();
778 pref_service_ = nullptr; 778 pref_service_ = nullptr;
779 shell_delegate_.reset(); 779 shell_delegate_.reset();
780 780
781 DCHECK(instance_ == this); 781 DCHECK(instance_ == this);
782 instance_ = nullptr; 782 instance_ = nullptr;
783 } 783 }
784 784
785 void Shell::Init(const ShellInitParams& init_params) { 785 void Shell::Init(const ShellInitParams& init_params) {
786 const bool is_mash = wm_shell_->IsRunningInMash(); 786 const bool is_mash = shell_port_->IsRunningInMash();
787 const Config config = wm_shell_->GetAshConfig(); 787 const Config config = shell_port_->GetAshConfig();
788 788
789 blocking_pool_ = init_params.blocking_pool; 789 blocking_pool_ = init_params.blocking_pool;
790 790
791 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); 791 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate();
792 792
793 // Can be null in tests. 793 // Can be null in tests.
794 if (wm_shell_->IsRunningInMash() && shell_delegate_->GetShellConnector()) { 794 if (shell_port_->IsRunningInMash() && shell_delegate_->GetShellConnector()) {
795 prefs::ConnectToPrefService( 795 prefs::ConnectToPrefService(
796 shell_delegate_->GetShellConnector(), 796 shell_delegate_->GetShellConnector(),
797 make_scoped_refptr(new PrefRegistrySimple()), 797 make_scoped_refptr(new PrefRegistrySimple()),
798 std::vector<PrefValueStore::PrefStoreType>(), 798 std::vector<PrefValueStore::PrefStoreType>(),
799 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), 799 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)),
800 prefs::mojom::kForwarderServiceName); 800 prefs::mojom::kForwarderServiceName);
801 } 801 }
802 802
803 // Some delegates access WmShell during their construction. Create them here 803 // Some delegates access ShellPort during their construction. Create them here
804 // instead of the WmShell constructor. 804 // instead of the ShellPort constructor.
805 accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate()); 805 accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate());
806 palette_delegate_ = shell_delegate_->CreatePaletteDelegate(); 806 palette_delegate_ = shell_delegate_->CreatePaletteDelegate();
807 toast_manager_ = base::MakeUnique<ToastManager>(); 807 toast_manager_ = base::MakeUnique<ToastManager>();
808 808
809 // Install the custom factory early on so that views::FocusManagers for Tray, 809 // Install the custom factory early on so that views::FocusManagers for Tray,
810 // Shelf, and WallPaper could be created by the factory. 810 // Shelf, and WallPaper could be created by the factory.
811 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 811 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
812 812
813 wallpaper_controller_ = base::MakeUnique<WallpaperController>(blocking_pool_); 813 wallpaper_controller_ = base::MakeUnique<WallpaperController>(blocking_pool_);
814 814
815 // Start devtools server 815 // Start devtools server
816 devtools_server_ = ui::devtools::UiDevToolsServer::Create(nullptr); 816 devtools_server_ = ui::devtools::UiDevToolsServer::Create(nullptr);
817 if (devtools_server_) { 817 if (devtools_server_) {
818 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); 818 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>();
819 auto css_backend = 819 auto css_backend =
820 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); 820 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get());
821 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( 821 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>(
822 "Ash", devtools_server_.get()); 822 "Ash", devtools_server_.get());
823 devtools_client->AddAgent(std::move(dom_backend)); 823 devtools_client->AddAgent(std::move(dom_backend));
824 devtools_client->AddAgent(std::move(css_backend)); 824 devtools_client->AddAgent(std::move(css_backend));
825 devtools_server_->AttachClient(std::move(devtools_client)); 825 devtools_server_->AttachClient(std::move(devtools_client));
826 } 826 }
827 827
828 if (is_mash) 828 if (is_mash)
829 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); 829 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>();
830 830
831 // TODO(sky): move creation to WmShell. 831 // TODO(sky): move creation to ShellPort.
832 if (!is_mash) 832 if (!is_mash)
833 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); 833 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>();
834 834
835 scoped_overview_animation_settings_factory_.reset( 835 scoped_overview_animation_settings_factory_.reset(
836 new ScopedOverviewAnimationSettingsFactoryAura); 836 new ScopedOverviewAnimationSettingsFactoryAura);
837 window_positioner_ = base::MakeUnique<WindowPositioner>(); 837 window_positioner_ = base::MakeUnique<WindowPositioner>();
838 838
839 if (config == Config::CLASSIC) { 839 if (config == Config::CLASSIC) {
840 // TODO: needs to work in mus. http://crbug.com/705592. 840 // TODO: needs to work in mus. http://crbug.com/705592.
841 native_cursor_manager_ = new AshNativeCursorManager; 841 native_cursor_manager_ = new AshNativeCursorManager;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 env_filter_.reset(new ::wm::CompoundEventFilter); 915 env_filter_.reset(new ::wm::CompoundEventFilter);
916 AddPreTargetHandler(env_filter_.get()); 916 AddPreTargetHandler(env_filter_.get());
917 917
918 // FocusController takes ownership of AshFocusRules. 918 // FocusController takes ownership of AshFocusRules.
919 focus_controller_ = 919 focus_controller_ =
920 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); 920 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules());
921 focus_controller_->AddObserver(this); 921 focus_controller_->AddObserver(this);
922 922
923 screen_position_controller_.reset(new ScreenPositionController); 923 screen_position_controller_.reset(new ScreenPositionController);
924 924
925 wm_shell_->CreatePrimaryHost(); 925 shell_port_->CreatePrimaryHost();
926 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); 926 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow());
927 927
928 if (!is_mash) { 928 if (!is_mash) {
929 resolution_notification_controller_.reset( 929 resolution_notification_controller_.reset(
930 new ResolutionNotificationController); 930 new ResolutionNotificationController);
931 } 931 }
932 932
933 if (cursor_manager_) { 933 if (cursor_manager_) {
934 cursor_manager_->SetDisplay( 934 cursor_manager_->SetDisplay(
935 display::Screen::GetScreen()->GetPrimaryDisplay()); 935 display::Screen::GetScreen()->GetPrimaryDisplay());
936 } 936 }
937 937
938 accelerator_controller_ = wm_shell_->CreateAcceleratorController(); 938 accelerator_controller_ = shell_port_->CreateAcceleratorController();
939 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); 939 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>();
940 940
941 if (config == Config::CLASSIC) { 941 if (config == Config::CLASSIC) {
942 // Not applicable to mus/mash as events are already routed to InputMethod 942 // Not applicable to mus/mash as events are already routed to InputMethod
943 // first. 943 // first.
944 AddPreTargetHandler( 944 AddPreTargetHandler(
945 window_tree_host_manager_->input_method_event_handler()); 945 window_tree_host_manager_->input_method_event_handler());
946 } 946 }
947 947
948 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); 948 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler();
(...skipping 12 matching lines...) Expand all
961 AddShellObserver(overlay_filter_.get()); 961 AddShellObserver(overlay_filter_.get());
962 962
963 accelerator_filter_.reset(new ::wm::AcceleratorFilter( 963 accelerator_filter_.reset(new ::wm::AcceleratorFilter(
964 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), 964 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate),
965 accelerator_controller_->accelerator_history())); 965 accelerator_controller_->accelerator_history()));
966 AddPreTargetHandler(accelerator_filter_.get()); 966 AddPreTargetHandler(accelerator_filter_.get());
967 967
968 event_transformation_handler_.reset(new EventTransformationHandler); 968 event_transformation_handler_.reset(new EventTransformationHandler);
969 AddPreTargetHandler(event_transformation_handler_.get()); 969 AddPreTargetHandler(event_transformation_handler_.get());
970 970
971 toplevel_window_event_handler_.reset( 971 toplevel_window_event_handler_ =
972 new ToplevelWindowEventHandler(wm_shell_.get())); 972 base::MakeUnique<ToplevelWindowEventHandler>();
973 973
974 if (!is_mash) { 974 if (!is_mash) {
975 system_gesture_filter_.reset(new SystemGestureEventFilter); 975 system_gesture_filter_.reset(new SystemGestureEventFilter);
976 AddPreTargetHandler(system_gesture_filter_.get()); 976 AddPreTargetHandler(system_gesture_filter_.get());
977 } 977 }
978 978
979 sticky_keys_controller_.reset(new StickyKeysController); 979 sticky_keys_controller_.reset(new StickyKeysController);
980 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); 980 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>();
981 981
982 lock_state_controller_ = 982 lock_state_controller_ =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 AddPreTargetHandler(tooltip_controller_.get()); 1032 AddPreTargetHandler(tooltip_controller_.get());
1033 1033
1034 modality_filter_.reset(new SystemModalContainerEventFilter(this)); 1034 modality_filter_.reset(new SystemModalContainerEventFilter(this));
1035 AddPreTargetHandler(modality_filter_.get()); 1035 AddPreTargetHandler(modality_filter_.get());
1036 1036
1037 event_client_.reset(new EventClientImpl); 1037 event_client_.reset(new EventClientImpl);
1038 1038
1039 session_state_delegate_.reset(shell_delegate_->CreateSessionStateDelegate()); 1039 session_state_delegate_.reset(shell_delegate_->CreateSessionStateDelegate());
1040 // Must occur after Shell has installed its early pre-target handlers (for 1040 // Must occur after Shell has installed its early pre-target handlers (for
1041 // example, WindowModalityController). 1041 // example, WindowModalityController).
1042 wm_shell_->CreatePointerWatcherAdapter(); 1042 shell_port_->CreatePointerWatcherAdapter();
1043 1043
1044 resize_shadow_controller_.reset(new ResizeShadowController()); 1044 resize_shadow_controller_.reset(new ResizeShadowController());
1045 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); 1045 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get()));
1046 1046
1047 SetSystemTrayDelegate( 1047 SetSystemTrayDelegate(
1048 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); 1048 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate()));
1049 1049
1050 // May trigger initialization of the Bluetooth adapter. 1050 // May trigger initialization of the Bluetooth adapter.
1051 tray_bluetooth_helper_->Initialize(); 1051 tray_bluetooth_helper_->Initialize();
1052 1052
1053 // Create AshTouchTransformController before 1053 // Create AshTouchTransformController before
1054 // WindowTreeHostManager::InitDisplays() 1054 // WindowTreeHostManager::InitDisplays()
1055 // since AshTouchTransformController listens on 1055 // since AshTouchTransformController listens on
1056 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). 1056 // WindowTreeHostManager::Observer::OnDisplaysInitialized().
1057 if (!is_mash) { 1057 if (!is_mash) {
1058 touch_transformer_controller_.reset(new AshTouchTransformController( 1058 touch_transformer_controller_.reset(new AshTouchTransformController(
1059 display_configurator_.get(), display_manager_.get())); 1059 display_configurator_.get(), display_manager_.get()));
1060 } 1060 }
1061 1061
1062 keyboard_ui_ = wm_shell_->CreateKeyboardUI(); 1062 keyboard_ui_ = shell_port_->CreateKeyboardUI();
1063 1063
1064 wm_shell_->InitHosts(init_params); 1064 shell_port_->InitHosts(init_params);
1065 1065
1066 // Needs to be created after InitDisplays() since it may cause the virtual 1066 // Needs to be created after InitDisplays() since it may cause the virtual
1067 // keyboard to be deployed. 1067 // keyboard to be deployed.
1068 if (!is_mash) 1068 if (!is_mash)
1069 virtual_keyboard_controller_.reset(new VirtualKeyboardController); 1069 virtual_keyboard_controller_.reset(new VirtualKeyboardController);
1070 1070
1071 audio_a11y_controller_.reset(new chromeos::AudioA11yController); 1071 audio_a11y_controller_.reset(new chromeos::AudioA11yController);
1072 1072
1073 // Initialize the wallpaper after the RootWindowController has been created, 1073 // Initialize the wallpaper after the RootWindowController has been created,
1074 // otherwise the widget will not paint when restoring after a browser crash. 1074 // otherwise the widget will not paint when restoring after a browser crash.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 toplevel_window_event_handler_.get()); 1142 toplevel_window_event_handler_.get());
1143 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); 1143 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get());
1144 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); 1144 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get());
1145 } 1145 }
1146 1146
1147 void Shell::SetSystemTrayDelegate( 1147 void Shell::SetSystemTrayDelegate(
1148 std::unique_ptr<SystemTrayDelegate> delegate) { 1148 std::unique_ptr<SystemTrayDelegate> delegate) {
1149 DCHECK(delegate); 1149 DCHECK(delegate);
1150 system_tray_delegate_ = std::move(delegate); 1150 system_tray_delegate_ = std::move(delegate);
1151 system_tray_delegate_->Initialize(); 1151 system_tray_delegate_->Initialize();
1152 // Accesses WmShell in its constructor. 1152 // Accesses ShellPort in its constructor.
1153 logout_confirmation_controller_.reset(new LogoutConfirmationController( 1153 logout_confirmation_controller_.reset(new LogoutConfirmationController(
1154 base::Bind(&SystemTrayController::SignOut, 1154 base::Bind(&SystemTrayController::SignOut,
1155 base::Unretained(system_tray_controller_.get())))); 1155 base::Unretained(system_tray_controller_.get()))));
1156 } 1156 }
1157 1157
1158 void Shell::DeleteSystemTrayDelegate() { 1158 void Shell::DeleteSystemTrayDelegate() {
1159 DCHECK(system_tray_delegate_); 1159 DCHECK(system_tray_delegate_);
1160 // Accesses WmShell in its destructor. 1160 // Accesses ShellPort in its destructor.
1161 logout_confirmation_controller_.reset(); 1161 logout_confirmation_controller_.reset();
1162 system_tray_delegate_.reset(); 1162 system_tray_delegate_.reset();
1163 } 1163 }
1164 1164
1165 void Shell::CloseAllRootWindowChildWindows() { 1165 void Shell::CloseAllRootWindowChildWindows() {
1166 for (WmWindow* wm_root_window : wm_shell_->GetAllRootWindows()) { 1166 for (WmWindow* wm_root_window : shell_port_->GetAllRootWindows()) {
1167 aura::Window* root_window = wm_root_window->aura_window(); 1167 aura::Window* root_window = wm_root_window->aura_window();
1168 RootWindowController* controller = GetRootWindowController(root_window); 1168 RootWindowController* controller = GetRootWindowController(root_window);
1169 if (controller) { 1169 if (controller) {
1170 controller->CloseChildWindows(); 1170 controller->CloseChildWindows();
1171 } else { 1171 } else {
1172 while (!root_window->children().empty()) { 1172 while (!root_window->children().empty()) {
1173 aura::Window* child = root_window->children()[0]; 1173 aura::Window* child = root_window->children()[0];
1174 delete child; 1174 delete child;
1175 } 1175 }
1176 } 1176 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 if (gained_active_wm) 1227 if (gained_active_wm)
1228 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); 1228 root_window_for_new_windows_ = gained_active_wm->GetRootWindow();
1229 } 1229 }
1230 1230
1231 void Shell::SessionStateChanged(session_manager::SessionState state) { 1231 void Shell::SessionStateChanged(session_manager::SessionState state) {
1232 // Create the shelf when a session becomes active. It's safe to do this 1232 // Create the shelf when a session becomes active. It's safe to do this
1233 // multiple times (e.g. initial login vs. multiprofile add session). 1233 // multiple times (e.g. initial login vs. multiprofile add session).
1234 if (state == session_manager::SessionState::ACTIVE) { 1234 if (state == session_manager::SessionState::ACTIVE) {
1235 CreateShelfView(); 1235 CreateShelfView();
1236 1236
1237 if (!wm_shell_->IsRunningInMash()) { 1237 if (!shell_port_->IsRunningInMash()) {
1238 // Recreate the keyboard after initial login and after multiprofile login. 1238 // Recreate the keyboard after initial login and after multiprofile login.
1239 CreateKeyboard(); 1239 CreateKeyboard();
1240 } 1240 }
1241 } 1241 }
1242 } 1242 }
1243 1243
1244 void Shell::LoginStatusChanged(LoginStatus login_status) { 1244 void Shell::LoginStatusChanged(LoginStatus login_status) {
1245 UpdateAfterLoginStatusChange(login_status); 1245 UpdateAfterLoginStatusChange(login_status);
1246 1246
1247 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. 1247 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged.
1248 for (auto& observer : shell_observers_) 1248 for (auto& observer : shell_observers_)
1249 observer.OnLoginStateChanged(login_status); 1249 observer.OnLoginStateChanged(login_status);
1250 } 1250 }
1251 1251
1252 void Shell::OnPrefServiceInitialized( 1252 void Shell::OnPrefServiceInitialized(
1253 std::unique_ptr<::PrefService> pref_service) { 1253 std::unique_ptr<::PrefService> pref_service) {
1254 if (!instance_) 1254 if (!instance_)
1255 return; 1255 return;
1256 DCHECK(pref_service); 1256 DCHECK(pref_service);
1257 pref_service_ = std::move(pref_service); 1257 pref_service_ = std::move(pref_service);
1258 } 1258 }
1259 1259
1260 } // namespace ash 1260 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698