| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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::OnCastingSessionStartedOrStopped(bool started) { | 336 void Shell::OnCastingSessionStartedOrStopped(bool started) { |
| 337 for (auto& observer : shell_observers_) | 337 for (auto& observer : shell_observers_) |
| 338 observer.OnCastingSessionStartedOrStopped(started); | 338 observer.OnCastingSessionStartedOrStopped(started); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void Shell::OnRootWindowAdded(WmWindow* root_window) { | 341 void Shell::OnRootWindowAdded(WmWindow* root_window) { |
| 342 for (auto& observer : shell_observers_) | 342 for (auto& observer : shell_observers_) |
| 343 observer.OnRootWindowAdded(root_window); | 343 observer.OnRootWindowAdded(root_window); |
| 344 } | 344 } |
| 345 | 345 |
| 346 void Shell::CreateKeyboard() { | 346 void Shell::CreateKeyboard() { |
| 347 InitKeyboard(); | 347 InitKeyboard(); |
| 348 GetPrimaryRootWindowController()->ActivateKeyboard( | 348 GetPrimaryRootWindowController()->ActivateKeyboard( |
| 349 keyboard::KeyboardController::GetInstance()); | 349 keyboard::KeyboardController::GetInstance()); |
| 350 } | 350 } |
| 351 | 351 |
| 352 void Shell::DeactivateKeyboard() { | 352 void Shell::DeactivateKeyboard() { |
| 353 // TODO(jamescook): Move keyboard create and hide into WmShell. | 353 // TODO(jamescook): Move keyboard create and hide into ShellPort. |
| 354 keyboard_ui_->Hide(); | 354 keyboard_ui_->Hide(); |
| 355 if (keyboard::KeyboardController::GetInstance()) { | 355 if (keyboard::KeyboardController::GetInstance()) { |
| 356 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 356 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 357 for (RootWindowControllerList::iterator iter = controllers.begin(); | 357 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 358 iter != controllers.end(); ++iter) { | 358 iter != controllers.end(); ++iter) { |
| 359 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); | 359 (*iter)->DeactivateKeyboard(keyboard::KeyboardController::GetInstance()); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 keyboard::KeyboardController::ResetInstance(nullptr); | 362 keyboard::KeyboardController::ResetInstance(nullptr); |
| 363 } | 363 } |
| 364 | 364 |
| 365 bool Shell::ShouldSaveDisplaySettings() { | 365 bool Shell::ShouldSaveDisplaySettings() { |
| 366 DCHECK(!wm_shell_->IsRunningInMash()); | 366 DCHECK(!shell_port_->IsRunningInMash()); |
| 367 return !( | 367 return !( |
| 368 screen_orientation_controller_->ignore_display_configuration_updates() || | 368 screen_orientation_controller_->ignore_display_configuration_updates() || |
| 369 resolution_notification_controller_->DoesNotificationTimeout()); | 369 resolution_notification_controller_->DoesNotificationTimeout()); |
| 370 } | 370 } |
| 371 | 371 |
| 372 ShelfModel* Shell::shelf_model() { | 372 ShelfModel* Shell::shelf_model() { |
| 373 return shelf_controller_->model(); | 373 return shelf_controller_->model(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 aura::client::ActivationClient* Shell::activation_client() { | 376 aura::client::ActivationClient* Shell::activation_client() { |
| 377 return focus_controller_.get(); | 377 return focus_controller_.get(); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void Shell::UpdateShelfVisibility() { | 380 void Shell::UpdateShelfVisibility() { |
| 381 for (WmWindow* root : wm_shell_->GetAllRootWindows()) | 381 for (WmWindow* root : shell_port_->GetAllRootWindows()) |
| 382 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState(); | 382 root->GetRootWindowController()->GetShelf()->UpdateVisibilityState(); |
| 383 } | 383 } |
| 384 | 384 |
| 385 WebNotificationTray* Shell::GetWebNotificationTray() { | 385 WebNotificationTray* Shell::GetWebNotificationTray() { |
| 386 return GetPrimaryRootWindowController() | 386 return GetPrimaryRootWindowController() |
| 387 ->GetStatusAreaWidget() | 387 ->GetStatusAreaWidget() |
| 388 ->web_notification_tray(); | 388 ->web_notification_tray(); |
| 389 } | 389 } |
| 390 | 390 |
| 391 bool Shell::HasPrimaryStatusArea() { | 391 bool Shell::HasPrimaryStatusArea() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 408 FirstRunHelper* Shell::CreateFirstRunHelper() { | 408 FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 409 return new FirstRunHelperImpl; | 409 return new FirstRunHelperImpl; |
| 410 } | 410 } |
| 411 | 411 |
| 412 void Shell::CreateShelfView() { | 412 void Shell::CreateShelfView() { |
| 413 // Must occur after SessionController creation and user login. | 413 // Must occur after SessionController creation and user login. |
| 414 DCHECK(session_controller()); | 414 DCHECK(session_controller()); |
| 415 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); | 415 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); |
| 416 CreateShelfDelegate(); | 416 CreateShelfDelegate(); |
| 417 | 417 |
| 418 for (WmWindow* root_window : wm_shell_->GetAllRootWindows()) | 418 for (WmWindow* root_window : shell_port_->GetAllRootWindows()) |
| 419 root_window->GetRootWindowController()->CreateShelfView(); | 419 root_window->GetRootWindowController()->CreateShelfView(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { | 422 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { |
| 423 window_tree_host_manager_->cursor_window_controller() | 423 window_tree_host_manager_->cursor_window_controller() |
| 424 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); | 424 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); |
| 425 } | 425 } |
| 426 | 426 |
| 427 void Shell::SetCursorCompositingEnabled(bool enabled) { | 427 void Shell::SetCursorCompositingEnabled(bool enabled) { |
| 428 if (GetAshConfig() == Config::CLASSIC) { | 428 if (GetAshConfig() == Config::CLASSIC) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 | 465 |
| 466 bool Shell::IsAppListVisible() const { | 466 bool Shell::IsAppListVisible() const { |
| 467 return app_list_->IsVisible(); | 467 return app_list_->IsVisible(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 bool Shell::GetAppListTargetVisibility() const { | 470 bool Shell::GetAppListTargetVisibility() const { |
| 471 return app_list_->GetTargetVisibility(); | 471 return app_list_->GetTargetVisibility(); |
| 472 } | 472 } |
| 473 | 473 |
| 474 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { | 474 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 475 for (WmWindow* root_window : wm_shell_->GetAllRootWindows()) { | 475 for (WmWindow* root_window : shell_port_->GetAllRootWindows()) { |
| 476 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( | 476 root_window->GetRootWindowController()->UpdateAfterLoginStatusChange( |
| 477 status); | 477 status); |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 | 480 |
| 481 void Shell::NotifyMaximizeModeStarted() { | 481 void Shell::NotifyMaximizeModeStarted() { |
| 482 for (auto& observer : shell_observers_) | 482 for (auto& observer : shell_observers_) |
| 483 observer.OnMaximizeModeStarted(); | 483 observer.OnMaximizeModeStarted(); |
| 484 } | 484 } |
| 485 | 485 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 532 |
| 533 void Shell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) { | 533 void Shell::NotifyShelfAutoHideBehaviorChanged(WmWindow* root_window) { |
| 534 for (auto& observer : shell_observers_) | 534 for (auto& observer : shell_observers_) |
| 535 observer.OnShelfAutoHideBehaviorChanged(root_window); | 535 observer.OnShelfAutoHideBehaviorChanged(root_window); |
| 536 } | 536 } |
| 537 | 537 |
| 538 //////////////////////////////////////////////////////////////////////////////// | 538 //////////////////////////////////////////////////////////////////////////////// |
| 539 // Shell, private: | 539 // Shell, private: |
| 540 | 540 |
| 541 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, | 541 Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, |
| 542 std::unique_ptr<WmShell> wm_shell) | 542 std::unique_ptr<ShellPort> shell_port) |
| 543 : wm_shell_(std::move(wm_shell)), | 543 : shell_port_(std::move(shell_port)), |
| 544 brightness_control_delegate_( | 544 brightness_control_delegate_( |
| 545 base::MakeUnique<system::BrightnessControllerChromeos>()), | 545 base::MakeUnique<system::BrightnessControllerChromeos>()), |
| 546 cast_config_(base::MakeUnique<CastConfigController>()), | 546 cast_config_(base::MakeUnique<CastConfigController>()), |
| 547 focus_cycler_(base::MakeUnique<FocusCycler>()), | 547 focus_cycler_(base::MakeUnique<FocusCycler>()), |
| 548 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), | 548 immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), |
| 549 keyboard_brightness_control_delegate_( | 549 keyboard_brightness_control_delegate_( |
| 550 base::MakeUnique<KeyboardBrightnessController>()), | 550 base::MakeUnique<KeyboardBrightnessController>()), |
| 551 locale_notification_controller_( | 551 locale_notification_controller_( |
| 552 base::MakeUnique<LocaleNotificationController>()), | 552 base::MakeUnique<LocaleNotificationController>()), |
| 553 media_controller_(base::MakeUnique<MediaController>()), | 553 media_controller_(base::MakeUnique<MediaController>()), |
| 554 new_window_controller_(base::MakeUnique<NewWindowController>()), | 554 new_window_controller_(base::MakeUnique<NewWindowController>()), |
| 555 session_controller_(base::MakeUnique<SessionController>()), | 555 session_controller_(base::MakeUnique<SessionController>()), |
| 556 shelf_controller_(base::MakeUnique<ShelfController>()), | 556 shelf_controller_(base::MakeUnique<ShelfController>()), |
| 557 shell_delegate_(std::move(shell_delegate)), | 557 shell_delegate_(std::move(shell_delegate)), |
| 558 shutdown_controller_(base::MakeUnique<ShutdownController>()), | 558 shutdown_controller_(base::MakeUnique<ShutdownController>()), |
| 559 system_tray_controller_(base::MakeUnique<SystemTrayController>()), | 559 system_tray_controller_(base::MakeUnique<SystemTrayController>()), |
| 560 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), | 560 system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), |
| 561 vpn_list_(base::MakeUnique<VpnList>()), | 561 vpn_list_(base::MakeUnique<VpnList>()), |
| 562 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), | 562 window_cycle_controller_(base::MakeUnique<WindowCycleController>()), |
| 563 window_selector_controller_(base::MakeUnique<WindowSelectorController>()), | 563 window_selector_controller_(base::MakeUnique<WindowSelectorController>()), |
| 564 app_list_(base::MakeUnique<app_list::AppList>()), | 564 app_list_(base::MakeUnique<app_list::AppList>()), |
| 565 link_handler_model_factory_(nullptr), | 565 link_handler_model_factory_(nullptr), |
| 566 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), | 566 tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), |
| 567 display_configurator_(new display::DisplayConfigurator()), | 567 display_configurator_(new display::DisplayConfigurator()), |
| 568 native_cursor_manager_(nullptr), | 568 native_cursor_manager_(nullptr), |
| 569 simulate_modal_window_open_for_testing_(false), | 569 simulate_modal_window_open_for_testing_(false), |
| 570 is_touch_hud_projection_enabled_(false) { | 570 is_touch_hud_projection_enabled_(false) { |
| 571 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash | 571 // TODO(sky): better refactor cash/mash dependencies. Perhaps put all cash |
| 572 // state on WmShellAura. http://crbug.com/671246. | 572 // state on ShellPortClassic. http://crbug.com/671246. |
| 573 | 573 |
| 574 if (!wm_shell_->IsRunningInMash()) { | 574 if (!shell_port_->IsRunningInMash()) { |
| 575 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); | 575 gpu_support_.reset(shell_delegate_->CreateGPUSupport()); |
| 576 display_manager_.reset(ScreenAsh::CreateDisplayManager()); | 576 display_manager_.reset(ScreenAsh::CreateDisplayManager()); |
| 577 window_tree_host_manager_.reset(new WindowTreeHostManager); | 577 window_tree_host_manager_.reset(new WindowTreeHostManager); |
| 578 user_metrics_recorder_.reset(new UserMetricsRecorder); | 578 user_metrics_recorder_.reset(new UserMetricsRecorder); |
| 579 } | 579 } |
| 580 | 580 |
| 581 PowerStatus::Initialize(); | 581 PowerStatus::Initialize(); |
| 582 | 582 |
| 583 session_controller_->AddSessionStateObserver(this); | 583 session_controller_->AddSessionStateObserver(this); |
| 584 } | 584 } |
| 585 | 585 |
| 586 Shell::~Shell() { | 586 Shell::~Shell() { |
| 587 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); | 587 TRACE_EVENT0("shutdown", "ash::Shell::Destructor"); |
| 588 | 588 |
| 589 const Config config = wm_shell_->GetAshConfig(); | 589 const Config config = shell_port_->GetAshConfig(); |
| 590 | 590 |
| 591 if (config != Config::MASH) | 591 if (config != Config::MASH) |
| 592 user_metrics_recorder_->OnShellShuttingDown(); | 592 user_metrics_recorder_->OnShellShuttingDown(); |
| 593 | 593 |
| 594 shell_delegate_->PreShutdown(); | 594 shell_delegate_->PreShutdown(); |
| 595 | 595 |
| 596 // Remove the focus from any window. This will prevent overhead and side | 596 // Remove the focus from any window. This will prevent overhead and side |
| 597 // effects (e.g. crashes) from changing focus during shutdown. | 597 // effects (e.g. crashes) from changing focus during shutdown. |
| 598 // See bug crbug.com/134502. | 598 // See bug crbug.com/134502. |
| 599 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); | 599 aura::client::GetFocusClient(GetPrimaryRootWindow())->FocusWindow(nullptr); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 maximize_mode_controller_.reset(); | 639 maximize_mode_controller_.reset(); |
| 640 | 640 |
| 641 // Destroy the keyboard before closing the shelf, since it will invoke a shelf | 641 // Destroy the keyboard before closing the shelf, since it will invoke a shelf |
| 642 // layout. | 642 // layout. |
| 643 DeactivateKeyboard(); | 643 DeactivateKeyboard(); |
| 644 | 644 |
| 645 toast_manager_.reset(); | 645 toast_manager_.reset(); |
| 646 | 646 |
| 647 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure | 647 // Destroy SystemTrayDelegate before destroying the status area(s). Make sure |
| 648 // to deinitialize the shelf first, as it is initialized after the delegate. | 648 // to deinitialize the shelf first, as it is initialized after the delegate. |
| 649 for (WmWindow* root : wm_shell_->GetAllRootWindows()) | 649 for (WmWindow* root : shell_port_->GetAllRootWindows()) |
| 650 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); | 650 root->GetRootWindowController()->GetShelf()->ShutdownShelfWidget(); |
| 651 tray_bluetooth_helper_.reset(); | 651 tray_bluetooth_helper_.reset(); |
| 652 DeleteSystemTrayDelegate(); | 652 DeleteSystemTrayDelegate(); |
| 653 | 653 |
| 654 // Drag-and-drop must be canceled prior to close all windows. | 654 // Drag-and-drop must be canceled prior to close all windows. |
| 655 drag_drop_controller_.reset(); | 655 drag_drop_controller_.reset(); |
| 656 | 656 |
| 657 // Controllers who have WindowObserver added must be deleted | 657 // Controllers who have WindowObserver added must be deleted |
| 658 // before |window_tree_host_manager_| is deleted. | 658 // before |window_tree_host_manager_| is deleted. |
| 659 | 659 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC | 725 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC |
| 726 // shelf items in Chrome) so explicitly shutdown early. | 726 // shelf items in Chrome) so explicitly shutdown early. |
| 727 shelf_model()->DestroyItemDelegates(); | 727 shelf_model()->DestroyItemDelegates(); |
| 728 | 728 |
| 729 // Must be destroyed before FocusController. | 729 // Must be destroyed before FocusController. |
| 730 shelf_delegate_.reset(); | 730 shelf_delegate_.reset(); |
| 731 | 731 |
| 732 // Removes itself as an observer of |pref_service_|. | 732 // Removes itself as an observer of |pref_service_|. |
| 733 shelf_controller_.reset(); | 733 shelf_controller_.reset(); |
| 734 | 734 |
| 735 wm_shell_->Shutdown(); | 735 shell_port_->Shutdown(); |
| 736 | 736 |
| 737 // Depends on |focus_controller_|, so must be destroyed before. | 737 // Depends on |focus_controller_|, so must be destroyed before. |
| 738 window_tree_host_manager_.reset(); | 738 window_tree_host_manager_.reset(); |
| 739 focus_controller_->RemoveObserver(this); | 739 focus_controller_->RemoveObserver(this); |
| 740 focus_controller_.reset(); | 740 focus_controller_.reset(); |
| 741 screen_position_controller_.reset(); | 741 screen_position_controller_.reset(); |
| 742 | 742 |
| 743 display_color_manager_.reset(); | 743 display_color_manager_.reset(); |
| 744 if (display_change_observer_) | 744 if (display_change_observer_) |
| 745 display_configurator_->RemoveObserver(display_change_observer_.get()); | 745 display_configurator_->RemoveObserver(display_change_observer_.get()); |
| 746 if (display_error_observer_) | 746 if (display_error_observer_) |
| 747 display_configurator_->RemoveObserver(display_error_observer_.get()); | 747 display_configurator_->RemoveObserver(display_error_observer_.get()); |
| 748 if (projecting_observer_) { | 748 if (projecting_observer_) { |
| 749 display_configurator_->RemoveObserver(projecting_observer_.get()); | 749 display_configurator_->RemoveObserver(projecting_observer_.get()); |
| 750 RemoveShellObserver(projecting_observer_.get()); | 750 RemoveShellObserver(projecting_observer_.get()); |
| 751 } | 751 } |
| 752 display_change_observer_.reset(); | 752 display_change_observer_.reset(); |
| 753 shutdown_observer_.reset(); | 753 shutdown_observer_.reset(); |
| 754 | 754 |
| 755 PowerStatus::Shutdown(); | 755 PowerStatus::Shutdown(); |
| 756 | 756 |
| 757 // Ensure that DBusThreadManager outlives this Shell. | 757 // Ensure that DBusThreadManager outlives this Shell. |
| 758 DCHECK(chromeos::DBusThreadManager::IsInitialized()); | 758 DCHECK(chromeos::DBusThreadManager::IsInitialized()); |
| 759 | 759 |
| 760 // Needs to happen right before |instance_| is reset. | 760 // Needs to happen right before |instance_| is reset. |
| 761 wm_shell_.reset(); | 761 shell_port_.reset(); |
| 762 session_controller_->RemoveSessionStateObserver(this); | 762 session_controller_->RemoveSessionStateObserver(this); |
| 763 wallpaper_delegate_.reset(); | 763 wallpaper_delegate_.reset(); |
| 764 pref_service_ = nullptr; | 764 pref_service_ = nullptr; |
| 765 shell_delegate_.reset(); | 765 shell_delegate_.reset(); |
| 766 | 766 |
| 767 DCHECK(instance_ == this); | 767 DCHECK(instance_ == this); |
| 768 instance_ = nullptr; | 768 instance_ = nullptr; |
| 769 } | 769 } |
| 770 | 770 |
| 771 void Shell::Init(const ShellInitParams& init_params) { | 771 void Shell::Init(const ShellInitParams& init_params) { |
| 772 const bool is_mash = wm_shell_->IsRunningInMash(); | 772 const bool is_mash = shell_port_->IsRunningInMash(); |
| 773 const Config config = wm_shell_->GetAshConfig(); | 773 const Config config = shell_port_->GetAshConfig(); |
| 774 | 774 |
| 775 blocking_pool_ = init_params.blocking_pool; | 775 blocking_pool_ = init_params.blocking_pool; |
| 776 | 776 |
| 777 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); | 777 wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); |
| 778 | 778 |
| 779 // Can be null in tests. | 779 // Can be null in tests. |
| 780 if (wm_shell_->IsRunningInMash() && shell_delegate_->GetShellConnector()) { | 780 if (shell_port_->IsRunningInMash() && shell_delegate_->GetShellConnector()) { |
| 781 prefs::ConnectToPrefService( | 781 prefs::ConnectToPrefService( |
| 782 shell_delegate_->GetShellConnector(), | 782 shell_delegate_->GetShellConnector(), |
| 783 make_scoped_refptr(new PrefRegistrySimple()), | 783 make_scoped_refptr(new PrefRegistrySimple()), |
| 784 std::vector<PrefValueStore::PrefStoreType>(), | 784 std::vector<PrefValueStore::PrefStoreType>(), |
| 785 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), | 785 base::Bind(&Shell::OnPrefServiceInitialized, base::Unretained(this)), |
| 786 prefs::mojom::kForwarderServiceName); | 786 prefs::mojom::kForwarderServiceName); |
| 787 } | 787 } |
| 788 | 788 |
| 789 // Some delegates access WmShell during their construction. Create them here | 789 // Some delegates access ShellPort during their construction. Create them here |
| 790 // instead of the WmShell constructor. | 790 // instead of the ShellPort constructor. |
| 791 accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate()); | 791 accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate()); |
| 792 palette_delegate_ = shell_delegate_->CreatePaletteDelegate(); | 792 palette_delegate_ = shell_delegate_->CreatePaletteDelegate(); |
| 793 toast_manager_ = base::MakeUnique<ToastManager>(); | 793 toast_manager_ = base::MakeUnique<ToastManager>(); |
| 794 | 794 |
| 795 // Install the custom factory early on so that views::FocusManagers for Tray, | 795 // Install the custom factory early on so that views::FocusManagers for Tray, |
| 796 // Shelf, and WallPaper could be created by the factory. | 796 // Shelf, and WallPaper could be created by the factory. |
| 797 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 797 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| 798 | 798 |
| 799 wallpaper_controller_ = base::MakeUnique<WallpaperController>(blocking_pool_); | 799 wallpaper_controller_ = base::MakeUnique<WallpaperController>(blocking_pool_); |
| 800 | 800 |
| 801 // Start devtools server | 801 // Start devtools server |
| 802 devtools_server_ = ui::devtools::UiDevToolsServer::Create(nullptr); | 802 devtools_server_ = ui::devtools::UiDevToolsServer::Create(nullptr); |
| 803 if (devtools_server_) { | 803 if (devtools_server_) { |
| 804 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); | 804 auto dom_backend = base::MakeUnique<devtools::AshDevToolsDOMAgent>(); |
| 805 auto css_backend = | 805 auto css_backend = |
| 806 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); | 806 base::MakeUnique<devtools::AshDevToolsCSSAgent>(dom_backend.get()); |
| 807 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( | 807 auto devtools_client = base::MakeUnique<ui::devtools::UiDevToolsClient>( |
| 808 "Ash", devtools_server_.get()); | 808 "Ash", devtools_server_.get()); |
| 809 devtools_client->AddAgent(std::move(dom_backend)); | 809 devtools_client->AddAgent(std::move(dom_backend)); |
| 810 devtools_client->AddAgent(std::move(css_backend)); | 810 devtools_client->AddAgent(std::move(css_backend)); |
| 811 devtools_server_->AttachClient(std::move(devtools_client)); | 811 devtools_server_->AttachClient(std::move(devtools_client)); |
| 812 } | 812 } |
| 813 | 813 |
| 814 if (is_mash) | 814 if (is_mash) |
| 815 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); | 815 app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); |
| 816 | 816 |
| 817 // TODO(sky): move creation to WmShell. | 817 // TODO(sky): move creation to ShellPort. |
| 818 if (!is_mash) | 818 if (!is_mash) |
| 819 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); | 819 immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); |
| 820 | 820 |
| 821 scoped_overview_animation_settings_factory_.reset( | 821 scoped_overview_animation_settings_factory_.reset( |
| 822 new ScopedOverviewAnimationSettingsFactoryAura); | 822 new ScopedOverviewAnimationSettingsFactoryAura); |
| 823 window_positioner_ = base::MakeUnique<WindowPositioner>(); | 823 window_positioner_ = base::MakeUnique<WindowPositioner>(); |
| 824 | 824 |
| 825 if (config == Config::CLASSIC) { | 825 if (config == Config::CLASSIC) { |
| 826 // TODO: needs to work in mus. http://crbug.com/705592. | 826 // TODO: needs to work in mus. http://crbug.com/705592. |
| 827 native_cursor_manager_ = new AshNativeCursorManager; | 827 native_cursor_manager_ = new AshNativeCursorManager; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 env_filter_.reset(new ::wm::CompoundEventFilter); | 901 env_filter_.reset(new ::wm::CompoundEventFilter); |
| 902 AddPreTargetHandler(env_filter_.get()); | 902 AddPreTargetHandler(env_filter_.get()); |
| 903 | 903 |
| 904 // FocusController takes ownership of AshFocusRules. | 904 // FocusController takes ownership of AshFocusRules. |
| 905 focus_controller_ = | 905 focus_controller_ = |
| 906 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); | 906 base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); |
| 907 focus_controller_->AddObserver(this); | 907 focus_controller_->AddObserver(this); |
| 908 | 908 |
| 909 screen_position_controller_.reset(new ScreenPositionController); | 909 screen_position_controller_.reset(new ScreenPositionController); |
| 910 | 910 |
| 911 wm_shell_->CreatePrimaryHost(); | 911 shell_port_->CreatePrimaryHost(); |
| 912 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); | 912 root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); |
| 913 | 913 |
| 914 if (!is_mash) { | 914 if (!is_mash) { |
| 915 resolution_notification_controller_.reset( | 915 resolution_notification_controller_.reset( |
| 916 new ResolutionNotificationController); | 916 new ResolutionNotificationController); |
| 917 } | 917 } |
| 918 | 918 |
| 919 if (cursor_manager_) { | 919 if (cursor_manager_) { |
| 920 cursor_manager_->SetDisplay( | 920 cursor_manager_->SetDisplay( |
| 921 display::Screen::GetScreen()->GetPrimaryDisplay()); | 921 display::Screen::GetScreen()->GetPrimaryDisplay()); |
| 922 } | 922 } |
| 923 | 923 |
| 924 accelerator_controller_ = wm_shell_->CreateAcceleratorController(); | 924 accelerator_controller_ = shell_port_->CreateAcceleratorController(); |
| 925 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); | 925 maximize_mode_controller_ = base::MakeUnique<MaximizeModeController>(); |
| 926 | 926 |
| 927 if (config == Config::CLASSIC) { | 927 if (config == Config::CLASSIC) { |
| 928 // Not applicable to mus/mash as events are already routed to InputMethod | 928 // Not applicable to mus/mash as events are already routed to InputMethod |
| 929 // first. | 929 // first. |
| 930 AddPreTargetHandler( | 930 AddPreTargetHandler( |
| 931 window_tree_host_manager_->input_method_event_handler()); | 931 window_tree_host_manager_->input_method_event_handler()); |
| 932 } | 932 } |
| 933 | 933 |
| 934 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); | 934 magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 947 AddShellObserver(overlay_filter_.get()); | 947 AddShellObserver(overlay_filter_.get()); |
| 948 | 948 |
| 949 accelerator_filter_.reset(new ::wm::AcceleratorFilter( | 949 accelerator_filter_.reset(new ::wm::AcceleratorFilter( |
| 950 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), | 950 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), |
| 951 accelerator_controller_->accelerator_history())); | 951 accelerator_controller_->accelerator_history())); |
| 952 AddPreTargetHandler(accelerator_filter_.get()); | 952 AddPreTargetHandler(accelerator_filter_.get()); |
| 953 | 953 |
| 954 event_transformation_handler_.reset(new EventTransformationHandler); | 954 event_transformation_handler_.reset(new EventTransformationHandler); |
| 955 AddPreTargetHandler(event_transformation_handler_.get()); | 955 AddPreTargetHandler(event_transformation_handler_.get()); |
| 956 | 956 |
| 957 toplevel_window_event_handler_.reset( | 957 toplevel_window_event_handler_ = |
| 958 new ToplevelWindowEventHandler(wm_shell_.get())); | 958 base::MakeUnique<ToplevelWindowEventHandler>(); |
| 959 | 959 |
| 960 if (!is_mash) { | 960 if (!is_mash) { |
| 961 system_gesture_filter_.reset(new SystemGestureEventFilter); | 961 system_gesture_filter_.reset(new SystemGestureEventFilter); |
| 962 AddPreTargetHandler(system_gesture_filter_.get()); | 962 AddPreTargetHandler(system_gesture_filter_.get()); |
| 963 } | 963 } |
| 964 | 964 |
| 965 sticky_keys_controller_.reset(new StickyKeysController); | 965 sticky_keys_controller_.reset(new StickyKeysController); |
| 966 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); | 966 screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); |
| 967 | 967 |
| 968 lock_state_controller_ = | 968 lock_state_controller_ = |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 AddPreTargetHandler(tooltip_controller_.get()); | 1018 AddPreTargetHandler(tooltip_controller_.get()); |
| 1019 | 1019 |
| 1020 modality_filter_.reset(new SystemModalContainerEventFilter(this)); | 1020 modality_filter_.reset(new SystemModalContainerEventFilter(this)); |
| 1021 AddPreTargetHandler(modality_filter_.get()); | 1021 AddPreTargetHandler(modality_filter_.get()); |
| 1022 | 1022 |
| 1023 event_client_.reset(new EventClientImpl); | 1023 event_client_.reset(new EventClientImpl); |
| 1024 | 1024 |
| 1025 session_state_delegate_.reset(shell_delegate_->CreateSessionStateDelegate()); | 1025 session_state_delegate_.reset(shell_delegate_->CreateSessionStateDelegate()); |
| 1026 // Must occur after Shell has installed its early pre-target handlers (for | 1026 // Must occur after Shell has installed its early pre-target handlers (for |
| 1027 // example, WindowModalityController). | 1027 // example, WindowModalityController). |
| 1028 wm_shell_->CreatePointerWatcherAdapter(); | 1028 shell_port_->CreatePointerWatcherAdapter(); |
| 1029 | 1029 |
| 1030 resize_shadow_controller_.reset(new ResizeShadowController()); | 1030 resize_shadow_controller_.reset(new ResizeShadowController()); |
| 1031 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); | 1031 shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); |
| 1032 | 1032 |
| 1033 SetSystemTrayDelegate( | 1033 SetSystemTrayDelegate( |
| 1034 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); | 1034 base::WrapUnique(shell_delegate_->CreateSystemTrayDelegate())); |
| 1035 | 1035 |
| 1036 // May trigger initialization of the Bluetooth adapter. | 1036 // May trigger initialization of the Bluetooth adapter. |
| 1037 tray_bluetooth_helper_->Initialize(); | 1037 tray_bluetooth_helper_->Initialize(); |
| 1038 | 1038 |
| 1039 // Create AshTouchTransformController before | 1039 // Create AshTouchTransformController before |
| 1040 // WindowTreeHostManager::InitDisplays() | 1040 // WindowTreeHostManager::InitDisplays() |
| 1041 // since AshTouchTransformController listens on | 1041 // since AshTouchTransformController listens on |
| 1042 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). | 1042 // WindowTreeHostManager::Observer::OnDisplaysInitialized(). |
| 1043 if (!is_mash) { | 1043 if (!is_mash) { |
| 1044 touch_transformer_controller_.reset(new AshTouchTransformController( | 1044 touch_transformer_controller_.reset(new AshTouchTransformController( |
| 1045 display_configurator_.get(), display_manager_.get())); | 1045 display_configurator_.get(), display_manager_.get())); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 keyboard_ui_ = wm_shell_->CreateKeyboardUI(); | 1048 keyboard_ui_ = shell_port_->CreateKeyboardUI(); |
| 1049 | 1049 |
| 1050 wm_shell_->InitHosts(init_params); | 1050 shell_port_->InitHosts(init_params); |
| 1051 | 1051 |
| 1052 // Needs to be created after InitDisplays() since it may cause the virtual | 1052 // Needs to be created after InitDisplays() since it may cause the virtual |
| 1053 // keyboard to be deployed. | 1053 // keyboard to be deployed. |
| 1054 if (!is_mash) | 1054 if (!is_mash) |
| 1055 virtual_keyboard_controller_.reset(new VirtualKeyboardController); | 1055 virtual_keyboard_controller_.reset(new VirtualKeyboardController); |
| 1056 | 1056 |
| 1057 audio_a11y_controller_.reset(new chromeos::AudioA11yController); | 1057 audio_a11y_controller_.reset(new chromeos::AudioA11yController); |
| 1058 | 1058 |
| 1059 // Initialize the wallpaper after the RootWindowController has been created, | 1059 // Initialize the wallpaper after the RootWindowController has been created, |
| 1060 // otherwise the widget will not paint when restoring after a browser crash. | 1060 // otherwise the widget will not paint when restoring after a browser crash. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 toplevel_window_event_handler_.get()); | 1128 toplevel_window_event_handler_.get()); |
| 1129 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); | 1129 root_window->AddPreTargetHandler(toplevel_window_event_handler_.get()); |
| 1130 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); | 1130 root_window->AddPostTargetHandler(toplevel_window_event_handler_.get()); |
| 1131 } | 1131 } |
| 1132 | 1132 |
| 1133 void Shell::SetSystemTrayDelegate( | 1133 void Shell::SetSystemTrayDelegate( |
| 1134 std::unique_ptr<SystemTrayDelegate> delegate) { | 1134 std::unique_ptr<SystemTrayDelegate> delegate) { |
| 1135 DCHECK(delegate); | 1135 DCHECK(delegate); |
| 1136 system_tray_delegate_ = std::move(delegate); | 1136 system_tray_delegate_ = std::move(delegate); |
| 1137 system_tray_delegate_->Initialize(); | 1137 system_tray_delegate_->Initialize(); |
| 1138 // Accesses WmShell in its constructor. | 1138 // Accesses ShellPort in its constructor. |
| 1139 logout_confirmation_controller_.reset(new LogoutConfirmationController( | 1139 logout_confirmation_controller_.reset(new LogoutConfirmationController( |
| 1140 base::Bind(&SystemTrayController::SignOut, | 1140 base::Bind(&SystemTrayController::SignOut, |
| 1141 base::Unretained(system_tray_controller_.get())))); | 1141 base::Unretained(system_tray_controller_.get())))); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 void Shell::DeleteSystemTrayDelegate() { | 1144 void Shell::DeleteSystemTrayDelegate() { |
| 1145 DCHECK(system_tray_delegate_); | 1145 DCHECK(system_tray_delegate_); |
| 1146 // Accesses WmShell in its destructor. | 1146 // Accesses ShellPort in its destructor. |
| 1147 logout_confirmation_controller_.reset(); | 1147 logout_confirmation_controller_.reset(); |
| 1148 system_tray_delegate_.reset(); | 1148 system_tray_delegate_.reset(); |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 void Shell::CloseAllRootWindowChildWindows() { | 1151 void Shell::CloseAllRootWindowChildWindows() { |
| 1152 for (WmWindow* wm_root_window : wm_shell_->GetAllRootWindows()) { | 1152 for (WmWindow* wm_root_window : shell_port_->GetAllRootWindows()) { |
| 1153 aura::Window* root_window = wm_root_window->aura_window(); | 1153 aura::Window* root_window = wm_root_window->aura_window(); |
| 1154 RootWindowController* controller = GetRootWindowController(root_window); | 1154 RootWindowController* controller = GetRootWindowController(root_window); |
| 1155 if (controller) { | 1155 if (controller) { |
| 1156 controller->CloseChildWindows(); | 1156 controller->CloseChildWindows(); |
| 1157 } else { | 1157 } else { |
| 1158 while (!root_window->children().empty()) { | 1158 while (!root_window->children().empty()) { |
| 1159 aura::Window* child = root_window->children()[0]; | 1159 aura::Window* child = root_window->children()[0]; |
| 1160 delete child; | 1160 delete child; |
| 1161 } | 1161 } |
| 1162 } | 1162 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 if (gained_active_wm) | 1213 if (gained_active_wm) |
| 1214 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); | 1214 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void Shell::SessionStateChanged(session_manager::SessionState state) { | 1217 void Shell::SessionStateChanged(session_manager::SessionState state) { |
| 1218 // Create the shelf when a session becomes active. It's safe to do this | 1218 // Create the shelf when a session becomes active. It's safe to do this |
| 1219 // multiple times (e.g. initial login vs. multiprofile add session). | 1219 // multiple times (e.g. initial login vs. multiprofile add session). |
| 1220 if (state == session_manager::SessionState::ACTIVE) { | 1220 if (state == session_manager::SessionState::ACTIVE) { |
| 1221 CreateShelfView(); | 1221 CreateShelfView(); |
| 1222 | 1222 |
| 1223 if (!wm_shell_->IsRunningInMash()) { | 1223 if (!shell_port_->IsRunningInMash()) { |
| 1224 // Recreate the keyboard after initial login and after multiprofile login. | 1224 // Recreate the keyboard after initial login and after multiprofile login. |
| 1225 CreateKeyboard(); | 1225 CreateKeyboard(); |
| 1226 } | 1226 } |
| 1227 } | 1227 } |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void Shell::LoginStatusChanged(LoginStatus login_status) { | 1230 void Shell::LoginStatusChanged(LoginStatus login_status) { |
| 1231 UpdateAfterLoginStatusChange(login_status); | 1231 UpdateAfterLoginStatusChange(login_status); |
| 1232 | 1232 |
| 1233 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. | 1233 // TODO(xiyuan): Update OnLoginStateChanged -> OnLoginStatusChanged. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1253 | 1253 |
| 1254 void Shell::OnPrefServiceInitialized( | 1254 void Shell::OnPrefServiceInitialized( |
| 1255 std::unique_ptr<::PrefService> pref_service) { | 1255 std::unique_ptr<::PrefService> pref_service) { |
| 1256 if (!instance_) | 1256 if (!instance_) |
| 1257 return; | 1257 return; |
| 1258 DCHECK(pref_service); | 1258 DCHECK(pref_service); |
| 1259 pref_service_ = std::move(pref_service); | 1259 pref_service_ = std::move(pref_service); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 } // namespace ash | 1262 } // namespace ash |
| OLD | NEW |