| 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..f718388defa5b5a5836aad2d88350767d989f013 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->SetOwner(this);
|
| + delayed_animations_.push_back(std::move(animation_observer));
|
| +}
|
| +
|
| +void WindowSelectorController::RemoveAndDestroyAnimationObserver(
|
| + 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",
|
|
|