1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_WM_OVERVIEW_SCOPED_WINDOW_COPY_H_ 6 #define ASH_WM_OVERVIEW_SCOPED_WINDOW_COPY_H_ 7 8 #include "base/basictypes.h" 9 10 namespace aura { 11 class Window; 12 } 13 14 namespace views { 15 class Widget; 16 } 17 18 namespace ash { 19 20 class CleanupWidgetAfterAnimationObserver; 21 22 // ScopedWindowCopy copies a window and will clean up the copied layers after 23 // the class goes out of scope and the last animation has finished. 24 class ScopedWindowCopy { 25 public: 26 ScopedWindowCopy(aura::Window* target_root, aura::Window* src_window); 27 ~ScopedWindowCopy(); 28 29 aura::Window* GetWindow(); 30 31 private: 32 // A weak pointer to a copy of the source window owned by cleanup_observer_. 33 views::Widget* widget_; 34 35 // A weak pointer to an animation observer which owns itself. When the 36 // ScopedWindowCopy is destroyed The animation observer will clean up the 37 // widget, layer and itself once any pending animations have completed. 38 CleanupWidgetAfterAnimationObserver* cleanup_observer_; 39 40 DISALLOW_COPY_AND_ASSIGN(ScopedWindowCopy); 41 }; 42 43 } // namespace ash 44 45 #endif // ASH_WM_OVERVIEW_SCOPED_WINDOW_COPY_H_ 46