1 // Copyright (c) 2012 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.
5 #ifndef ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_
6 #define ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/compositor/layer_animation_observer.h"
24 class ColoredWindowController
;
26 // DesktopBackgroundFadeController handles fading in or out the desktop. It is
27 // used when maximizing or restoring a window. It is implemented as a colored
28 // layer whose opacity varies. This results in fading in or out all the windows
29 // the DesktopBackgroundFadeController is placed on top of. This is used
30 // instead of varying the opacity for two reasons:
31 // . The window showing background and the desktop workspace do not have a
32 // common parent that can be animated. This could be fixed, but wouldn't
33 // address the following.
34 // . When restoring the window is moved back to the desktop workspace. If we
35 // animated the opacity of the desktop workspace the cross fade would be
37 class ASH_EXPORT DesktopBackgroundFadeController
38 : public ui::ImplicitAnimationObserver
{
46 // Creates a new DesktopBackgroundFadeController. |parent| is the Window to
47 // parent the newly created window to. The newly created window is stacked
48 // directly on top of |position_above|. The window animating the fade is
49 // destroyed as soon as the animation completes.
50 DesktopBackgroundFadeController(aura::Window
* parent
,
51 aura::Window
* position_above
,
52 base::TimeDelta duration
,
54 virtual ~DesktopBackgroundFadeController();
57 // ImplicitAnimationObserver overrides:
58 virtual void OnImplicitAnimationsCompleted() OVERRIDE
;
60 scoped_ptr
<ColoredWindowController
> window_controller_
;
62 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundFadeController
);
65 } // namespace internal
68 #endif // ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_