| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ash/common/shelf/shelf_item_delegate_manager.h" | 23 #include "ash/common/shelf/shelf_item_delegate_manager.h" |
| 24 #include "ash/common/shelf/shelf_model.h" | 24 #include "ash/common/shelf/shelf_model.h" |
| 25 #include "ash/common/shell_window_ids.h" | 25 #include "ash/common/shell_window_ids.h" |
| 26 #include "ash/common/system/locale/locale_notification_controller.h" | 26 #include "ash/common/system/locale/locale_notification_controller.h" |
| 27 #include "ash/common/system/tray/system_tray_delegate.h" | 27 #include "ash/common/system/tray/system_tray_delegate.h" |
| 28 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" | 28 #include "ash/common/wm/maximize_mode/maximize_mode_window_manager.h" |
| 29 #include "ash/common/wm/mru_window_tracker.h" | 29 #include "ash/common/wm/mru_window_tracker.h" |
| 30 #include "ash/common/wm/root_window_finder.h" | 30 #include "ash/common/wm/root_window_finder.h" |
| 31 #include "ash/common/wm/window_positioner.h" | 31 #include "ash/common/wm/window_positioner.h" |
| 32 #include "ash/common/wm_shell.h" | 32 #include "ash/common/wm_shell.h" |
| 33 #include "ash/common/wm_shell_common.h" | |
| 34 #include "ash/desktop_background/desktop_background_controller.h" | 33 #include "ash/desktop_background/desktop_background_controller.h" |
| 35 #include "ash/desktop_background/desktop_background_view.h" | 34 #include "ash/desktop_background/desktop_background_view.h" |
| 36 #include "ash/desktop_background/user_wallpaper_delegate.h" | 35 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 37 #include "ash/display/cursor_window_controller.h" | 36 #include "ash/display/cursor_window_controller.h" |
| 38 #include "ash/display/display_configuration_controller.h" | 37 #include "ash/display/display_configuration_controller.h" |
| 39 #include "ash/display/display_manager.h" | 38 #include "ash/display/display_manager.h" |
| 40 #include "ash/display/event_transformation_handler.h" | 39 #include "ash/display/event_transformation_handler.h" |
| 41 #include "ash/display/mouse_cursor_event_filter.h" | 40 #include "ash/display/mouse_cursor_event_filter.h" |
| 42 #include "ash/display/screen_position_controller.h" | 41 #include "ash/display/screen_position_controller.h" |
| 43 #include "ash/display/window_tree_host_manager.h" | 42 #include "ash/display/window_tree_host_manager.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 // Use translucent-style window frames for dialogs. | 343 // Use translucent-style window frames for dialogs. |
| 345 return new CustomFrameViewAsh(widget); | 344 return new CustomFrameViewAsh(widget); |
| 346 } | 345 } |
| 347 | 346 |
| 348 void Shell::SetDisplayWorkAreaInsets(Window* contains, | 347 void Shell::SetDisplayWorkAreaInsets(Window* contains, |
| 349 const gfx::Insets& insets) { | 348 const gfx::Insets& insets) { |
| 350 if (!window_tree_host_manager_->UpdateWorkAreaOfDisplayNearestWindow( | 349 if (!window_tree_host_manager_->UpdateWorkAreaOfDisplayNearestWindow( |
| 351 contains, insets)) { | 350 contains, insets)) { |
| 352 return; | 351 return; |
| 353 } | 352 } |
| 354 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 353 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 355 OnDisplayWorkAreaInsetsChanged()); | 354 OnDisplayWorkAreaInsetsChanged()); |
| 356 } | 355 } |
| 357 | 356 |
| 358 void Shell::OnLoginStateChanged(LoginStatus status) { | 357 void Shell::OnLoginStateChanged(LoginStatus status) { |
| 359 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 358 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 360 OnLoginStateChanged(status)); | 359 OnLoginStateChanged(status)); |
| 361 } | 360 } |
| 362 | 361 |
| 363 void Shell::OnLoginUserProfilePrepared() { | 362 void Shell::OnLoginUserProfilePrepared() { |
| 364 CreateShelf(); | 363 CreateShelf(); |
| 365 CreateKeyboard(); | 364 CreateKeyboard(); |
| 366 } | 365 } |
| 367 | 366 |
| 368 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { | 367 void Shell::UpdateAfterLoginStatusChange(LoginStatus status) { |
| 369 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 368 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 370 for (RootWindowControllerList::iterator iter = controllers.begin(); | 369 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 371 iter != controllers.end(); ++iter) | 370 iter != controllers.end(); ++iter) |
| 372 (*iter)->UpdateAfterLoginStatusChange(status); | 371 (*iter)->UpdateAfterLoginStatusChange(status); |
| 373 } | 372 } |
| 374 | 373 |
| 375 void Shell::OnAppTerminating() { | 374 void Shell::OnAppTerminating() { |
| 376 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 375 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 377 OnAppTerminating()); | 376 OnAppTerminating()); |
| 378 } | 377 } |
| 379 | 378 |
| 380 void Shell::OnLockStateChanged(bool locked) { | 379 void Shell::OnLockStateChanged(bool locked) { |
| 381 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 380 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 382 OnLockStateChanged(locked)); | 381 OnLockStateChanged(locked)); |
| 383 #ifndef NDEBUG | 382 #ifndef NDEBUG |
| 384 // Make sure that there is no system modal in Lock layer when unlocked. | 383 // Make sure that there is no system modal in Lock layer when unlocked. |
| 385 if (!locked) { | 384 if (!locked) { |
| 386 std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( | 385 std::vector<aura::Window*> containers = GetContainersFromAllRootWindows( |
| 387 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); | 386 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); |
| 388 for (std::vector<aura::Window*>::const_iterator iter = containers.begin(); | 387 for (std::vector<aura::Window*>::const_iterator iter = containers.begin(); |
| 389 iter != containers.end(); ++iter) { | 388 iter != containers.end(); ++iter) { |
| 390 DCHECK_EQ(0u, (*iter)->children().size()); | 389 DCHECK_EQ(0u, (*iter)->children().size()); |
| 391 } | 390 } |
| 392 } | 391 } |
| 393 #endif | 392 #endif |
| 394 } | 393 } |
| 395 | 394 |
| 396 void Shell::OnCastingSessionStartedOrStopped(bool started) { | 395 void Shell::OnCastingSessionStartedOrStopped(bool started) { |
| 397 #if defined(OS_CHROMEOS) | 396 #if defined(OS_CHROMEOS) |
| 398 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 397 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 399 OnCastingSessionStartedOrStopped(started)); | 398 OnCastingSessionStartedOrStopped(started)); |
| 400 #endif | 399 #endif |
| 401 } | 400 } |
| 402 | 401 |
| 403 void Shell::OnMaximizeModeStarted() { | 402 void Shell::OnMaximizeModeStarted() { |
| 404 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 403 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 405 OnMaximizeModeStarted()); | 404 OnMaximizeModeStarted()); |
| 406 } | 405 } |
| 407 | 406 |
| 408 void Shell::OnMaximizeModeEnded() { | 407 void Shell::OnMaximizeModeEnded() { |
| 409 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 408 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 410 OnMaximizeModeEnded()); | 409 OnMaximizeModeEnded()); |
| 411 } | 410 } |
| 412 | 411 |
| 413 void Shell::OnRootWindowAdded(WmWindow* root_window) { | 412 void Shell::OnRootWindowAdded(WmWindow* root_window) { |
| 414 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 413 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 415 OnRootWindowAdded(root_window)); | 414 OnRootWindowAdded(root_window)); |
| 416 } | 415 } |
| 417 | 416 |
| 418 void Shell::CreateShelf() { | 417 void Shell::CreateShelf() { |
| 419 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 418 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 420 for (RootWindowControllerList::iterator iter = controllers.begin(); | 419 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 421 iter != controllers.end(); ++iter) | 420 iter != controllers.end(); ++iter) |
| 422 (*iter)->CreateShelf(); | 421 (*iter)->CreateShelf(); |
| 423 } | 422 } |
| 424 | 423 |
| 425 void Shell::OnShelfCreatedForRootWindow(WmWindow* root_window) { | 424 void Shell::OnShelfCreatedForRootWindow(WmWindow* root_window) { |
| 426 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 425 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 427 OnShelfCreatedForRootWindow(root_window)); | 426 OnShelfCreatedForRootWindow(root_window)); |
| 428 } | 427 } |
| 429 | 428 |
| 430 void Shell::CreateKeyboard() { | 429 void Shell::CreateKeyboard() { |
| 431 if (in_mus_) | 430 if (in_mus_) |
| 432 return; | 431 return; |
| 433 // TODO(bshe): Primary root window controller may not be the controller to | 432 // TODO(bshe): Primary root window controller may not be the controller to |
| 434 // attach virtual keyboard. See http://crbug.com/303429 | 433 // attach virtual keyboard. See http://crbug.com/303429 |
| 435 InitKeyboard(); | 434 InitKeyboard(); |
| 436 GetPrimaryRootWindowController()->ActivateKeyboard( | 435 GetPrimaryRootWindowController()->ActivateKeyboard( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 485 |
| 487 void Shell::UpdateShelfVisibility() { | 486 void Shell::UpdateShelfVisibility() { |
| 488 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 487 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 489 for (RootWindowControllerList::iterator iter = controllers.begin(); | 488 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| 490 iter != controllers.end(); ++iter) | 489 iter != controllers.end(); ++iter) |
| 491 if ((*iter)->shelf_widget()) | 490 if ((*iter)->shelf_widget()) |
| 492 (*iter)->UpdateShelfVisibility(); | 491 (*iter)->UpdateShelfVisibility(); |
| 493 } | 492 } |
| 494 | 493 |
| 495 void Shell::OnShelfAlignmentChanged(WmWindow* root_window) { | 494 void Shell::OnShelfAlignmentChanged(WmWindow* root_window) { |
| 496 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 495 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 497 OnShelfAlignmentChanged(root_window)); | 496 OnShelfAlignmentChanged(root_window)); |
| 498 } | 497 } |
| 499 | 498 |
| 500 void Shell::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) { | 499 void Shell::OnShelfAutoHideBehaviorChanged(WmWindow* root_window) { |
| 501 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 500 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 502 OnShelfAutoHideBehaviorChanged(root_window)); | 501 OnShelfAutoHideBehaviorChanged(root_window)); |
| 503 } | 502 } |
| 504 | 503 |
| 505 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, | 504 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, |
| 506 WmWindow* root_window) { | 505 WmWindow* root_window) { |
| 507 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 506 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 508 OnFullscreenStateChanged(is_fullscreen, root_window)); | 507 OnFullscreenStateChanged(is_fullscreen, root_window)); |
| 509 } | 508 } |
| 510 | 509 |
| 511 void Shell::CreateModalBackground(aura::Window* window) { | 510 void Shell::CreateModalBackground(aura::Window* window) { |
| 512 if (!modality_filter_) { | 511 if (!modality_filter_) { |
| 513 modality_filter_.reset(new SystemModalContainerEventFilter(this)); | 512 modality_filter_.reset(new SystemModalContainerEventFilter(this)); |
| 514 AddPreTargetHandler(modality_filter_.get()); | 513 AddPreTargetHandler(modality_filter_.get()); |
| 515 } | 514 } |
| 516 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 515 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
| 517 for (RootWindowControllerList::iterator iter = controllers.begin(); | 516 for (RootWindowControllerList::iterator iter = controllers.begin(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 shelf_model_.get(), shelf_item_delegate_manager_.get())); | 573 shelf_model_.get(), shelf_item_delegate_manager_.get())); |
| 575 } | 574 } |
| 576 return shelf_delegate_.get(); | 575 return shelf_delegate_.get(); |
| 577 } | 576 } |
| 578 | 577 |
| 579 void Shell::SetTouchHudProjectionEnabled(bool enabled) { | 578 void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| 580 if (is_touch_hud_projection_enabled_ == enabled) | 579 if (is_touch_hud_projection_enabled_ == enabled) |
| 581 return; | 580 return; |
| 582 | 581 |
| 583 is_touch_hud_projection_enabled_ = enabled; | 582 is_touch_hud_projection_enabled_ = enabled; |
| 584 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 583 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 585 OnTouchHudProjectionToggled(enabled)); | 584 OnTouchHudProjectionToggled(enabled)); |
| 586 } | 585 } |
| 587 | 586 |
| 588 #if defined(OS_CHROMEOS) | 587 #if defined(OS_CHROMEOS) |
| 589 FirstRunHelper* Shell::CreateFirstRunHelper() { | 588 FirstRunHelper* Shell::CreateFirstRunHelper() { |
| 590 return new FirstRunHelperImpl; | 589 return new FirstRunHelperImpl; |
| 591 } | 590 } |
| 592 | 591 |
| 593 void Shell::SetCursorCompositingEnabled(bool enabled) { | 592 void Shell::SetCursorCompositingEnabled(bool enabled) { |
| 594 window_tree_host_manager_->cursor_window_controller() | 593 window_tree_host_manager_->cursor_window_controller() |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 721 |
| 723 // |shelf_window_watcher_| has a weak pointer to |shelf_Model_| | 722 // |shelf_window_watcher_| has a weak pointer to |shelf_Model_| |
| 724 // and has window observers. | 723 // and has window observers. |
| 725 shelf_window_watcher_.reset(); | 724 shelf_window_watcher_.reset(); |
| 726 | 725 |
| 727 // Destroy all child windows including widgets. | 726 // Destroy all child windows including widgets. |
| 728 window_tree_host_manager_->CloseChildWindows(); | 727 window_tree_host_manager_->CloseChildWindows(); |
| 729 // MruWindowTracker must be destroyed after all windows have been deleted to | 728 // MruWindowTracker must be destroyed after all windows have been deleted to |
| 730 // avoid a possible crash when Shell is destroyed from a non-normal shutdown | 729 // avoid a possible crash when Shell is destroyed from a non-normal shutdown |
| 731 // path. (crbug.com/485438). | 730 // path. (crbug.com/485438). |
| 732 wm_shell_common_->DeleteMruWindowTracker(); | 731 wm_shell_->DeleteMruWindowTracker(); |
| 733 | 732 |
| 734 // Chrome implementation of shelf delegate depends on FocusClient, | 733 // Chrome implementation of shelf delegate depends on FocusClient, |
| 735 // so must be deleted before |focus_client_| (below). | 734 // so must be deleted before |focus_client_| (below). |
| 736 shelf_delegate_.reset(); | 735 shelf_delegate_.reset(); |
| 737 | 736 |
| 738 // These need a valid Shell instance to clean up properly, so explicitly | 737 // These need a valid Shell instance to clean up properly, so explicitly |
| 739 // delete them before invalidating the instance. | 738 // delete them before invalidating the instance. |
| 740 // Alphabetical. TODO(oshima): sort. | 739 // Alphabetical. TODO(oshima): sort. |
| 741 magnification_controller_.reset(); | 740 magnification_controller_.reset(); |
| 742 partial_magnification_controller_.reset(); | 741 partial_magnification_controller_.reset(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 keyboard::KeyboardController::ResetInstance(nullptr); | 789 keyboard::KeyboardController::ResetInstance(nullptr); |
| 791 | 790 |
| 792 #if defined(OS_CHROMEOS) | 791 #if defined(OS_CHROMEOS) |
| 793 display_color_manager_.reset(); | 792 display_color_manager_.reset(); |
| 794 if (display_change_observer_) | 793 if (display_change_observer_) |
| 795 display_configurator_->RemoveObserver(display_change_observer_.get()); | 794 display_configurator_->RemoveObserver(display_change_observer_.get()); |
| 796 if (display_error_observer_) | 795 if (display_error_observer_) |
| 797 display_configurator_->RemoveObserver(display_error_observer_.get()); | 796 display_configurator_->RemoveObserver(display_error_observer_.get()); |
| 798 if (projecting_observer_) { | 797 if (projecting_observer_) { |
| 799 display_configurator_->RemoveObserver(projecting_observer_.get()); | 798 display_configurator_->RemoveObserver(projecting_observer_.get()); |
| 800 wm_shell_common_->RemoveShellObserver(projecting_observer_.get()); | 799 wm_shell_->RemoveShellObserver(projecting_observer_.get()); |
| 801 } | 800 } |
| 802 display_change_observer_.reset(); | 801 display_change_observer_.reset(); |
| 803 | 802 |
| 804 PowerStatus::Shutdown(); | 803 PowerStatus::Shutdown(); |
| 805 | 804 |
| 806 // Ensure that DBusThreadManager outlives this Shell. | 805 // Ensure that DBusThreadManager outlives this Shell. |
| 807 DCHECK(chromeos::DBusThreadManager::IsInitialized()); | 806 DCHECK(chromeos::DBusThreadManager::IsInitialized()); |
| 808 #endif | 807 #endif |
| 809 | 808 |
| 810 // Needs to happen right before |instance_| is reset. | 809 // Needs to happen right before |instance_| is reset. |
| 811 wm_shell_.reset(); | 810 wm_shell_.reset(); |
| 812 | 811 |
| 813 // Must happen after |wm_shell_| is deleted. | |
| 814 wm_shell_common_.reset(); | |
| 815 | |
| 816 DCHECK(instance_ == this); | 812 DCHECK(instance_ == this); |
| 817 instance_ = nullptr; | 813 instance_ = nullptr; |
| 818 } | 814 } |
| 819 | 815 |
| 820 void Shell::Init(const ShellInitParams& init_params) { | 816 void Shell::Init(const ShellInitParams& init_params) { |
| 821 in_mus_ = init_params.in_mus; | 817 in_mus_ = init_params.in_mus; |
| 822 | 818 |
| 823 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 819 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 824 DCHECK(in_mus_) << "linux desktop does not support ash."; | 820 DCHECK(in_mus_) << "linux desktop does not support ash."; |
| 825 #endif | 821 #endif |
| 826 | 822 |
| 827 wm_shell_common_.reset(new WmShellCommon); | 823 wm_shell_.reset(new WmShellAura); |
| 828 wm_shell_.reset(new WmShellAura(wm_shell_common_.get())); | |
| 829 scoped_overview_animation_settings_factory_.reset( | 824 scoped_overview_animation_settings_factory_.reset( |
| 830 new ScopedOverviewAnimationSettingsFactoryAura); | 825 new ScopedOverviewAnimationSettingsFactoryAura); |
| 831 window_positioner_.reset(new WindowPositioner(wm_shell_.get())); | 826 window_positioner_.reset(new WindowPositioner(wm_shell_.get())); |
| 832 | 827 |
| 833 if (!in_mus_) { | 828 if (!in_mus_) { |
| 834 native_cursor_manager_ = new AshNativeCursorManager; | 829 native_cursor_manager_ = new AshNativeCursorManager; |
| 835 #if defined(OS_CHROMEOS) | 830 #if defined(OS_CHROMEOS) |
| 836 cursor_manager_.reset( | 831 cursor_manager_.reset( |
| 837 new CursorManager(base::WrapUnique(native_cursor_manager_))); | 832 new CursorManager(base::WrapUnique(native_cursor_manager_))); |
| 838 #else | 833 #else |
| (...skipping 24 matching lines...) Expand all Loading... |
| 863 !gpu_support_->IsPanelFittingDisabled()); | 858 !gpu_support_->IsPanelFittingDisabled()); |
| 864 #endif | 859 #endif |
| 865 } | 860 } |
| 866 | 861 |
| 867 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. | 862 // The DBusThreadManager must outlive this Shell. See the DCHECK in ~Shell. |
| 868 chromeos::DBusThreadManager* dbus_thread_manager = | 863 chromeos::DBusThreadManager* dbus_thread_manager = |
| 869 chromeos::DBusThreadManager::Get(); | 864 chromeos::DBusThreadManager::Get(); |
| 870 projecting_observer_.reset( | 865 projecting_observer_.reset( |
| 871 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); | 866 new ProjectingObserver(dbus_thread_manager->GetPowerManagerClient())); |
| 872 display_configurator_->AddObserver(projecting_observer_.get()); | 867 display_configurator_->AddObserver(projecting_observer_.get()); |
| 873 wm_shell_common_->AddShellObserver(projecting_observer_.get()); | 868 wm_shell_->AddShellObserver(projecting_observer_.get()); |
| 874 | 869 |
| 875 if (!in_mus_ && !display_initialized && | 870 if (!in_mus_ && !display_initialized && |
| 876 base::SysInfo::IsRunningOnChromeOS()) { | 871 base::SysInfo::IsRunningOnChromeOS()) { |
| 877 display_change_observer_.reset(new DisplayChangeObserver); | 872 display_change_observer_.reset(new DisplayChangeObserver); |
| 878 // Register |display_change_observer_| first so that the rest of | 873 // Register |display_change_observer_| first so that the rest of |
| 879 // observer gets invoked after the root windows are configured. | 874 // observer gets invoked after the root windows are configured. |
| 880 display_configurator_->AddObserver(display_change_observer_.get()); | 875 display_configurator_->AddObserver(display_change_observer_.get()); |
| 881 display_error_observer_.reset(new DisplayErrorObserver()); | 876 display_error_observer_.reset(new DisplayErrorObserver()); |
| 882 display_configurator_->AddObserver(display_error_observer_.get()); | 877 display_configurator_->AddObserver(display_error_observer_.get()); |
| 883 display_configurator_->set_state_controller(display_change_observer_.get()); | 878 display_configurator_->set_state_controller(display_change_observer_.get()); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 #endif | 942 #endif |
| 948 | 943 |
| 949 // The order in which event filters are added is significant. | 944 // The order in which event filters are added is significant. |
| 950 | 945 |
| 951 // ui::UserActivityDetector passes events to observers, so let them get | 946 // ui::UserActivityDetector passes events to observers, so let them get |
| 952 // rewritten first. | 947 // rewritten first. |
| 953 user_activity_detector_.reset(new ui::UserActivityDetector); | 948 user_activity_detector_.reset(new ui::UserActivityDetector); |
| 954 | 949 |
| 955 overlay_filter_.reset(new OverlayEventFilter); | 950 overlay_filter_.reset(new OverlayEventFilter); |
| 956 AddPreTargetHandler(overlay_filter_.get()); | 951 AddPreTargetHandler(overlay_filter_.get()); |
| 957 wm_shell_common_->AddShellObserver(overlay_filter_.get()); | 952 wm_shell_->AddShellObserver(overlay_filter_.get()); |
| 958 | 953 |
| 959 accelerator_filter_.reset(new ::wm::AcceleratorFilter( | 954 accelerator_filter_.reset(new ::wm::AcceleratorFilter( |
| 960 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), | 955 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), |
| 961 accelerator_controller_->accelerator_history())); | 956 accelerator_controller_->accelerator_history())); |
| 962 AddPreTargetHandler(accelerator_filter_.get()); | 957 AddPreTargetHandler(accelerator_filter_.get()); |
| 963 | 958 |
| 964 event_transformation_handler_.reset(new EventTransformationHandler); | 959 event_transformation_handler_.reset(new EventTransformationHandler); |
| 965 AddPreTargetHandler(event_transformation_handler_.get()); | 960 AddPreTargetHandler(event_transformation_handler_.get()); |
| 966 | 961 |
| 967 toplevel_window_event_handler_.reset( | 962 toplevel_window_event_handler_.reset( |
| 968 new ToplevelWindowEventHandler(wm_shell_.get())); | 963 new ToplevelWindowEventHandler(wm_shell_.get())); |
| 969 | 964 |
| 970 system_gesture_filter_.reset(new SystemGestureEventFilter); | 965 system_gesture_filter_.reset(new SystemGestureEventFilter); |
| 971 AddPreTargetHandler(system_gesture_filter_.get()); | 966 AddPreTargetHandler(system_gesture_filter_.get()); |
| 972 | 967 |
| 973 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); | 968 keyboard_metrics_filter_.reset(new KeyboardUMAEventFilter); |
| 974 AddPreTargetHandler(keyboard_metrics_filter_.get()); | 969 AddPreTargetHandler(keyboard_metrics_filter_.get()); |
| 975 | 970 |
| 976 #if defined(OS_CHROMEOS) | 971 #if defined(OS_CHROMEOS) |
| 977 sticky_keys_controller_.reset(new StickyKeysController); | 972 sticky_keys_controller_.reset(new StickyKeysController); |
| 978 #endif | 973 #endif |
| 979 screen_pinning_controller_.reset(new ScreenPinningController( | 974 screen_pinning_controller_.reset( |
| 980 wm_shell_common_.get(), window_tree_host_manager_.get())); | 975 new ScreenPinningController(window_tree_host_manager_.get())); |
| 981 | 976 |
| 982 lock_state_controller_.reset(new LockStateController); | 977 lock_state_controller_.reset(new LockStateController); |
| 983 power_button_controller_.reset( | 978 power_button_controller_.reset( |
| 984 new PowerButtonController(lock_state_controller_.get())); | 979 new PowerButtonController(lock_state_controller_.get())); |
| 985 #if defined(OS_CHROMEOS) | 980 #if defined(OS_CHROMEOS) |
| 986 // Pass the initial display state to PowerButtonController. | 981 // Pass the initial display state to PowerButtonController. |
| 987 power_button_controller_->OnDisplayModeChanged( | 982 power_button_controller_->OnDisplayModeChanged( |
| 988 display_configurator_->cached_displays()); | 983 display_configurator_->cached_displays()); |
| 989 #endif | 984 #endif |
| 990 wm_shell_common_->AddShellObserver(lock_state_controller_.get()); | 985 wm_shell_->AddShellObserver(lock_state_controller_.get()); |
| 991 | 986 |
| 992 drag_drop_controller_.reset(new DragDropController); | 987 drag_drop_controller_.reset(new DragDropController); |
| 993 // |screenshot_controller_| needs to be created (and prepended as a | 988 // |screenshot_controller_| needs to be created (and prepended as a |
| 994 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to | 989 // pre-target handler) at this point, because |mouse_cursor_filter_| needs to |
| 995 // process mouse events prior to screenshot session. | 990 // process mouse events prior to screenshot session. |
| 996 // See http://crbug.com/459214 | 991 // See http://crbug.com/459214 |
| 997 screenshot_controller_.reset(new ScreenshotController()); | 992 screenshot_controller_.reset(new ScreenshotController()); |
| 998 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); | 993 mouse_cursor_filter_.reset(new MouseCursorEventFilter()); |
| 999 PrependPreTargetHandler(mouse_cursor_filter_.get()); | 994 PrependPreTargetHandler(mouse_cursor_filter_.get()); |
| 1000 | 995 |
| 1001 // Create Controllers that may need root window. | 996 // Create Controllers that may need root window. |
| 1002 // TODO(oshima): Move as many controllers before creating | 997 // TODO(oshima): Move as many controllers before creating |
| 1003 // RootWindowController as possible. | 998 // RootWindowController as possible. |
| 1004 visibility_controller_.reset(new AshVisibilityController); | 999 visibility_controller_.reset(new AshVisibilityController); |
| 1005 | 1000 |
| 1006 magnification_controller_.reset(MagnificationController::CreateInstance()); | 1001 magnification_controller_.reset(MagnificationController::CreateInstance()); |
| 1007 wm_shell_common_->CreateMruWindowTracker(); | 1002 wm_shell_->CreateMruWindowTracker(); |
| 1008 | 1003 |
| 1009 partial_magnification_controller_.reset(new PartialMagnificationController()); | 1004 partial_magnification_controller_.reset(new PartialMagnificationController()); |
| 1010 | 1005 |
| 1011 autoclick_controller_.reset(AutoclickController::CreateInstance()); | 1006 autoclick_controller_.reset(AutoclickController::CreateInstance()); |
| 1012 | 1007 |
| 1013 high_contrast_controller_.reset(new HighContrastController); | 1008 high_contrast_controller_.reset(new HighContrastController); |
| 1014 video_detector_.reset(new VideoDetector); | 1009 video_detector_.reset(new VideoDetector); |
| 1015 window_cycle_controller_.reset(new WindowCycleController()); | 1010 window_cycle_controller_.reset(new WindowCycleController()); |
| 1016 | 1011 |
| 1017 tooltip_controller_.reset(new views::corewm::TooltipController( | 1012 tooltip_controller_.reset(new views::corewm::TooltipController( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 video_activity_notifier_.reset( | 1089 video_activity_notifier_.reset( |
| 1095 new VideoActivityNotifier(video_detector_.get())); | 1090 new VideoActivityNotifier(video_detector_.get())); |
| 1096 bluetooth_notification_controller_.reset(new BluetoothNotificationController); | 1091 bluetooth_notification_controller_.reset(new BluetoothNotificationController); |
| 1097 screen_orientation_controller_.reset(new ScreenOrientationController()); | 1092 screen_orientation_controller_.reset(new ScreenOrientationController()); |
| 1098 #endif | 1093 #endif |
| 1099 // The compositor thread and main message loop have to be running in | 1094 // The compositor thread and main message loop have to be running in |
| 1100 // order to create mirror window. Run it after the main message loop | 1095 // order to create mirror window. Run it after the main message loop |
| 1101 // is started. | 1096 // is started. |
| 1102 display_manager_->CreateMirrorWindowAsyncIfAny(); | 1097 display_manager_->CreateMirrorWindowAsyncIfAny(); |
| 1103 | 1098 |
| 1104 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_common_->shell_observers(), | 1099 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
| 1105 OnShellInitialized()); | 1100 OnShellInitialized()); |
| 1106 | 1101 |
| 1107 user_metrics_recorder_->OnShellInitialized(); | 1102 user_metrics_recorder_->OnShellInitialized(); |
| 1108 } | 1103 } |
| 1109 | 1104 |
| 1110 void Shell::InitKeyboard() { | 1105 void Shell::InitKeyboard() { |
| 1111 if (in_mus_) | 1106 if (in_mus_) |
| 1112 return; | 1107 return; |
| 1113 | 1108 |
| 1114 if (keyboard::IsKeyboardEnabled()) { | 1109 if (keyboard::IsKeyboardEnabled()) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 | 1178 |
| 1184 void Shell::OnWindowActivated( | 1179 void Shell::OnWindowActivated( |
| 1185 aura::client::ActivationChangeObserver::ActivationReason reason, | 1180 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1186 aura::Window* gained_active, | 1181 aura::Window* gained_active, |
| 1187 aura::Window* lost_active) { | 1182 aura::Window* lost_active) { |
| 1188 if (gained_active) | 1183 if (gained_active) |
| 1189 target_root_window_ = gained_active->GetRootWindow(); | 1184 target_root_window_ = gained_active->GetRootWindow(); |
| 1190 } | 1185 } |
| 1191 | 1186 |
| 1192 } // namespace ash | 1187 } // namespace ash |
| OLD | NEW |