Chromium Code Reviews| Index: ash/common/wm/overview/window_selector_controller.cc |
| diff --git a/ash/common/wm/overview/window_selector_controller.cc b/ash/common/wm/overview/window_selector_controller.cc |
| index 265c8bd43d00ed7870e0208da2f6069d4ee33d06..fbe7a11c8a9bfb8834659a423238278f98b4fa1c 100644 |
| --- a/ash/common/wm/overview/window_selector_controller.cc |
| +++ b/ash/common/wm/overview/window_selector_controller.cc |
| @@ -19,7 +19,14 @@ namespace ash { |
| WindowSelectorController::WindowSelectorController() {} |
| -WindowSelectorController::~WindowSelectorController() {} |
| +WindowSelectorController::~WindowSelectorController() { |
| + // Destroy widgets that may be still animating if shell shuts down soon after |
| + // exiting overview mode. |
| + for (std::unique_ptr<DelayedAnimationObserver>& animation_observer : |
| + delayed_animations_) { |
| + animation_observer->Shutdown(); |
| + } |
| +} |
| // static |
| bool WindowSelectorController::CanSelect() { |
| @@ -79,6 +86,31 @@ void WindowSelectorController::OnSelectionEnded() { |
| WmShell::Get()->OnOverviewModeEnded(); |
| } |
| +void WindowSelectorController::AddDelayedAnimationObserver( |
| + std::unique_ptr<DelayedAnimationObserver> animation_observer) { |
| + animation_observer->SetDelegate(this); |
| + delayed_animations_.push_back(std::move(animation_observer)); |
| +} |
| + |
| +void WindowSelectorController::RemoveDelayedAnimationObserver( |
|
bruthig
2016/07/15 17:05:38
This is only implemented correctly if called from
varkha
2016/07/15 18:53:36
Done (Added some comment in the RemoveDelayedAnima
|
| + DelayedAnimationObserver* animation_observer) { |
| + class IsEqual { |
| + public: |
| + explicit IsEqual(DelayedAnimationObserver* animation_observer) |
| + : animation_observer_(animation_observer) {} |
| + bool operator()(const std::unique_ptr<DelayedAnimationObserver>& other) { |
| + return (other.get() == animation_observer_); |
| + } |
| + |
| + private: |
| + const DelayedAnimationObserver* animation_observer_; |
| + }; |
| + delayed_animations_.erase( |
| + std::remove_if(delayed_animations_.begin(), delayed_animations_.end(), |
| + IsEqual(animation_observer)), |
| + delayed_animations_.end()); |
| +} |
| + |
| void WindowSelectorController::OnSelectionStarted() { |
| if (!last_selection_time_.is_null()) { |
| UMA_HISTOGRAM_LONG_TIMES("Ash.WindowSelector.TimeBetweenUse", |