Index: ash/common/wm/overview/cleanup_animation_observer.h |
diff --git a/ash/common/wm/overview/cleanup_animation_observer.h b/ash/common/wm/overview/cleanup_animation_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3ad4ffd157f8e1adf6c32e64cc7decd1689604d |
--- /dev/null |
+++ b/ash/common/wm/overview/cleanup_animation_observer.h |
@@ -0,0 +1,48 @@ |
+// 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. |
+ |
+#ifndef ASH_COMMON_WM_OVERVIEW_CLEANUP_ANIMATION_OBSERVER_H_ |
+#define ASH_COMMON_WM_OVERVIEW_CLEANUP_ANIMATION_OBSERVER_H_ |
+ |
+#include <memory> |
+ |
+#include "ash/ash_export.h" |
+#include "ash/common/wm/overview/window_selector_delegate.h" |
+#include "base/macros.h" |
+#include "ui/compositor/layer_animation_observer.h" |
+ |
+namespace views { |
+class Widget; |
+} |
+ |
+namespace ash { |
+ |
+// An observer which holds onto the passed widget until the animation is |
+// complete. |
+class ASH_EXPORT CleanupAnimationObserver |
+ : public ui::ImplicitAnimationObserver, |
+ public DelayedAnimationObserver { |
+ public: |
+ explicit CleanupAnimationObserver(std::unique_ptr<views::Widget> widget); |
+ ~CleanupAnimationObserver() override; |
+ |
+ // ui::ImplicitAnimationObserver: |
+ // TODO(varkha): Look into all cases when animations are not started such as |
+ // zero-duration animations and ensure that the object lifetime is handled. |
+ void OnImplicitAnimationsCompleted() override; |
+ |
+ // DelayedAnimationObserver: |
+ void SetOwner(WindowSelectorDelegate* owner) override; |
+ void Shutdown() override; |
+ |
+ private: |
+ std::unique_ptr<views::Widget> widget_; |
+ WindowSelectorDelegate* owner_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CleanupAnimationObserver); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_COMMON_WM_OVERVIEW_CLEANUP_ANIMATION_OBSERVER_H_ |