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

Unified Diff: ash/common/wm/overview/cleanup_animation_observer.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 (nits) 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/cleanup_animation_observer.cc
diff --git a/ash/common/wm/overview/cleanup_animation_observer.cc b/ash/common/wm/overview/cleanup_animation_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9feed4c25160e2ffad0b5adf6d70ed1b40b00e79
--- /dev/null
+++ b/ash/common/wm/overview/cleanup_animation_observer.cc
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/common/wm/overview/cleanup_animation_observer.h"
+
+#include "ui/views/widget/widget.h"
+
+namespace ash {
+
+CleanupAnimationObserver::CleanupAnimationObserver(
+ std::unique_ptr<views::Widget> widget)
+ : widget_(std::move(widget)), owner_(nullptr) {
+ DCHECK(widget_);
+}
+
+CleanupAnimationObserver::~CleanupAnimationObserver() {}
+
+void CleanupAnimationObserver::OnImplicitAnimationsCompleted() {
+ // |widget_| may get reset if Shutdown() is called prior to this method.
+ if (!widget_)
+ return;
+ if (owner_) {
+ owner_->RemoveAndDestroyAnimationObserver(this);
+ return;
+ }
+ delete this;
+}
+
+void CleanupAnimationObserver::SetOwner(WindowSelectorDelegate* owner) {
+ owner_ = owner;
+}
+
+void CleanupAnimationObserver::Shutdown() {
+ widget_.reset();
+ owner_ = nullptr;
+}
+
+} // namespace ash
« no previous file with comments | « ash/common/wm/overview/cleanup_animation_observer.h ('k') | ash/common/wm/overview/cleanup_animation_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698