• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 RootWindow;
12 class Window;
13 }
14 
15 namespace ui {
16 class Layer;
17 }
18 
19 namespace views {
20 class Widget;
21 }
22 
23 namespace ash {
24 
25 class CleanupWidgetAfterAnimationObserver;
26 
27 // ScopedWindowCopy copies a window and will clean up the copied layers after
28 // the class goes out of scope and the last animation has finished.
29 class ScopedWindowCopy {
30  public:
31   ScopedWindowCopy(aura::Window* target_root, aura::Window* src_window);
32   ~ScopedWindowCopy();
33 
34   aura::Window* GetWindow();
35 
36  private:
37   // A weak pointer to a copy of the source window owned by cleanup_observer_.
38   views::Widget* widget_;
39 
40   // A weak pointer to the deep copy of the source window's layers owned by
41   // cleanup_observer_.
42   ui::Layer* layer_;
43 
44   // A weak pointer to an animation observer which owns itself. When the
45   // ScopedWindowCopy is destroyed The animation observer will clean up the
46   // widget, layer and itself once any pending animations have completed.
47   CleanupWidgetAfterAnimationObserver* cleanup_observer_;
48 
49   DISALLOW_COPY_AND_ASSIGN(ScopedWindowCopy);
50 };
51 
52 }  // namespace ash
53 
54 #endif  // ASH_WM_OVERVIEW_SCOPED_WINDOW_COPY_H_
55