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