Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: ash/common/wm/overview/window_selector_controller.cc

Issue 2141133002: [ash-md] Animates overview shield in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Completes shield opacity animation after overview closes (avoids crashes with delayed anim… Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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",

Powered by Google App Engine
This is Rietveld 408576698