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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 OnShelfAutoHideBehaviorChanged(root_window)); | 494 OnShelfAutoHideBehaviorChanged(root_window)); |
495 } | 495 } |
496 | 496 |
497 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, | 497 void Shell::NotifyFullscreenStateChange(bool is_fullscreen, |
498 WmWindow* root_window) { | 498 WmWindow* root_window) { |
499 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), | 499 FOR_EACH_OBSERVER(ShellObserver, *wm_shell_->shell_observers(), |
500 OnFullscreenStateChanged(is_fullscreen, root_window)); | 500 OnFullscreenStateChanged(is_fullscreen, root_window)); |
501 } | 501 } |
502 | 502 |
503 void Shell::CreateModalBackground(aura::Window* window) { | 503 void Shell::CreateModalBackground(aura::Window* window) { |
504 if (!modality_filter_) { | |
505 modality_filter_.reset(new SystemModalContainerEventFilter(this)); | |
506 AddPreTargetHandler(modality_filter_.get()); | |
507 } | |
508 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 504 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
509 for (RootWindowControllerList::iterator iter = controllers.begin(); | 505 for (RootWindowControllerList::iterator iter = controllers.begin(); |
510 iter != controllers.end(); ++iter) | 506 iter != controllers.end(); ++iter) |
511 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); | 507 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); |
512 } | 508 } |
513 | 509 |
514 void Shell::OnModalWindowRemoved(aura::Window* removed) { | 510 void Shell::OnModalWindowRemoved(aura::Window* removed) { |
515 RootWindowControllerList controllers = GetAllRootWindowControllers(); | 511 RootWindowControllerList controllers = GetAllRootWindowControllers(); |
516 bool activated = false; | 512 bool activated = false; |
517 for (RootWindowControllerList::iterator iter = controllers.begin(); | 513 for (RootWindowControllerList::iterator iter = controllers.begin(); |
518 iter != controllers.end() && !activated; ++iter) { | 514 iter != controllers.end() && !activated; ++iter) { |
519 activated = (*iter) | 515 activated = (*iter) |
520 ->GetSystemModalLayoutManager(removed) | 516 ->GetSystemModalLayoutManager(removed) |
521 ->ActivateNextModalWindow(); | 517 ->ActivateNextModalWindow(); |
522 } | 518 } |
523 if (!activated) { | 519 if (!activated) { |
524 RemovePreTargetHandler(modality_filter_.get()); | |
525 modality_filter_.reset(); | |
526 for (RootWindowControllerList::iterator iter = controllers.begin(); | 520 for (RootWindowControllerList::iterator iter = controllers.begin(); |
527 iter != controllers.end(); ++iter) | 521 iter != controllers.end(); ++iter) |
528 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); | 522 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); |
529 } | 523 } |
530 } | 524 } |
531 | 525 |
532 WebNotificationTray* Shell::GetWebNotificationTray() { | 526 WebNotificationTray* Shell::GetWebNotificationTray() { |
533 return GetPrimaryRootWindowController() | 527 return GetPrimaryRootWindowController() |
534 ->shelf_widget() | 528 ->shelf_widget() |
535 ->status_area_widget() | 529 ->status_area_widget() |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
651 speech_feedback_handler_.reset(); | 645 speech_feedback_handler_.reset(); |
652 #endif | 646 #endif |
653 RemovePreTargetHandler(overlay_filter_.get()); | 647 RemovePreTargetHandler(overlay_filter_.get()); |
654 RemovePreTargetHandler(accelerator_filter_.get()); | 648 RemovePreTargetHandler(accelerator_filter_.get()); |
655 RemovePreTargetHandler(event_transformation_handler_.get()); | 649 RemovePreTargetHandler(event_transformation_handler_.get()); |
656 RemovePreTargetHandler(toplevel_window_event_handler_.get()); | 650 RemovePreTargetHandler(toplevel_window_event_handler_.get()); |
657 RemovePostTargetHandler(toplevel_window_event_handler_.get()); | 651 RemovePostTargetHandler(toplevel_window_event_handler_.get()); |
658 RemovePreTargetHandler(system_gesture_filter_.get()); | 652 RemovePreTargetHandler(system_gesture_filter_.get()); |
659 RemovePreTargetHandler(keyboard_metrics_filter_.get()); | 653 RemovePreTargetHandler(keyboard_metrics_filter_.get()); |
660 RemovePreTargetHandler(mouse_cursor_filter_.get()); | 654 RemovePreTargetHandler(mouse_cursor_filter_.get()); |
655 RemovePreTargetHandler(modality_filter_.get()); | |
661 | 656 |
662 // TooltipController is deleted with the Shell so removing its references. | 657 // TooltipController is deleted with the Shell so removing its references. |
663 RemovePreTargetHandler(tooltip_controller_.get()); | 658 RemovePreTargetHandler(tooltip_controller_.get()); |
664 | 659 |
665 #if defined(OS_CHROMEOS) | 660 #if defined(OS_CHROMEOS) |
666 screen_orientation_controller_.reset(); | 661 screen_orientation_controller_.reset(); |
667 #endif | 662 #endif |
668 | 663 |
669 // Destroy the virtual keyboard controller before the maximize mode controller | 664 // Destroy the virtual keyboard controller before the maximize mode controller |
670 // since the latters destructor triggers events that the former is listening | 665 // since the latters destructor triggers events that the former is listening |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 lock_state_controller_.reset(); | 740 lock_state_controller_.reset(); |
746 | 741 |
747 screen_pinning_controller_.reset(); | 742 screen_pinning_controller_.reset(); |
748 | 743 |
749 #if defined(OS_CHROMEOS) | 744 #if defined(OS_CHROMEOS) |
750 resolution_notification_controller_.reset(); | 745 resolution_notification_controller_.reset(); |
751 #endif | 746 #endif |
752 desktop_background_controller_.reset(); | 747 desktop_background_controller_.reset(); |
753 screenshot_controller_.reset(); | 748 screenshot_controller_.reset(); |
754 mouse_cursor_filter_.reset(); | 749 mouse_cursor_filter_.reset(); |
755 | 750 |
oshima
2016/07/14 21:49:41
reset the event handler here.
| |
756 #if defined(OS_CHROMEOS) | 751 #if defined(OS_CHROMEOS) |
757 touch_transformer_controller_.reset(); | 752 touch_transformer_controller_.reset(); |
758 #endif // defined(OS_CHROMEOS) | 753 #endif // defined(OS_CHROMEOS) |
759 | 754 |
760 #if defined(OS_CHROMEOS) | 755 #if defined(OS_CHROMEOS) |
761 audio_a11y_controller_.reset(); | 756 audio_a11y_controller_.reset(); |
762 #endif // defined(OS_CHROMEOS) | 757 #endif // defined(OS_CHROMEOS) |
763 | 758 |
764 // This also deletes all RootWindows. Note that we invoke Shutdown() on | 759 // This also deletes all RootWindows. Note that we invoke Shutdown() on |
765 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since | 760 // WindowTreeHostManager before resetting |window_tree_host_manager_|, since |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 autoclick_controller_.reset(AutoclickController::CreateInstance()); | 992 autoclick_controller_.reset(AutoclickController::CreateInstance()); |
998 | 993 |
999 high_contrast_controller_.reset(new HighContrastController); | 994 high_contrast_controller_.reset(new HighContrastController); |
1000 video_detector_.reset(new VideoDetector); | 995 video_detector_.reset(new VideoDetector); |
1001 window_cycle_controller_.reset(new WindowCycleController()); | 996 window_cycle_controller_.reset(new WindowCycleController()); |
1002 | 997 |
1003 tooltip_controller_.reset(new views::corewm::TooltipController( | 998 tooltip_controller_.reset(new views::corewm::TooltipController( |
1004 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); | 999 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); |
1005 AddPreTargetHandler(tooltip_controller_.get()); | 1000 AddPreTargetHandler(tooltip_controller_.get()); |
1006 | 1001 |
1002 modality_filter_.reset(new SystemModalContainerEventFilter(this)); | |
1003 AddPreTargetHandler(modality_filter_.get()); | |
1004 | |
1007 event_client_.reset(new EventClientImpl); | 1005 event_client_.reset(new EventClientImpl); |
1008 | 1006 |
1009 // This controller needs to be set before SetupManagedWindowMode. | 1007 // This controller needs to be set before SetupManagedWindowMode. |
1010 desktop_background_controller_.reset( | 1008 desktop_background_controller_.reset( |
1011 new DesktopBackgroundController(blocking_pool_)); | 1009 new DesktopBackgroundController(blocking_pool_)); |
1012 user_wallpaper_delegate_.reset( | 1010 user_wallpaper_delegate_.reset( |
1013 wm_shell_->delegate()->CreateUserWallpaperDelegate()); | 1011 wm_shell_->delegate()->CreateUserWallpaperDelegate()); |
1014 | 1012 |
1015 session_state_delegate_.reset( | 1013 session_state_delegate_.reset( |
1016 wm_shell_->delegate()->CreateSessionStateDelegate()); | 1014 wm_shell_->delegate()->CreateSessionStateDelegate()); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1168 | 1166 |
1169 void Shell::OnWindowActivated( | 1167 void Shell::OnWindowActivated( |
1170 aura::client::ActivationChangeObserver::ActivationReason reason, | 1168 aura::client::ActivationChangeObserver::ActivationReason reason, |
1171 aura::Window* gained_active, | 1169 aura::Window* gained_active, |
1172 aura::Window* lost_active) { | 1170 aura::Window* lost_active) { |
1173 if (gained_active) | 1171 if (gained_active) |
1174 target_root_window_ = gained_active->GetRootWindow(); | 1172 target_root_window_ = gained_active->GetRootWindow(); |
1175 } | 1173 } |
1176 | 1174 |
1177 } // namespace ash | 1175 } // namespace ash |
OLD | NEW |