Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ash / wm / workspace / desktop_background_fade_controller.h
blob3cc0137da6f53e7342ff836e7801c932d4db4d70
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"
13 namespace aura {
14 class Window;
17 namespace base {
18 class TimeDelta;
21 namespace ash {
22 namespace internal {
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
36 // effected.
37 class ASH_EXPORT DesktopBackgroundFadeController
38 : public ui::ImplicitAnimationObserver {
39 public:
40 // Direction to fade.
41 enum Direction {
42 FADE_IN,
43 FADE_OUT,
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,
53 Direction direction);
54 virtual ~DesktopBackgroundFadeController();
56 private:
57 // ImplicitAnimationObserver overrides:
58 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
60 scoped_ptr<ColoredWindowController> window_controller_;
62 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundFadeController);
65 } // namespace internal
66 } // namespace ash
68 #endif // ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_