Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ash / display / display_configurator_animation.h
1 // Copyright 2014 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_DISPLAY_DISPLAY_CONFIGURATOR_ANIMATION_H_
6 #define ASH_DISPLAY_DISPLAY_CONFIGURATOR_ANIMATION_H_
7
8 #include <map>
9
10 #include "ash/ash_export.h"
11 #include "base/callback.h"
12 #include "base/timer/timer.h"
13 #include "ui/display/chromeos/display_configurator.h"
14
15 namespace aura {
16 class RootWindow;
17 class Window;
18 }  // namespace aura
19
20 namespace ui {
21 class Layer;
22 }  // namespace ui
23
24 namespace ash {
25
26 // DisplayConfiguratorAnimation provides the visual effects for
27 // ui::DisplayConfigurator, such like fade-out/in during changing
28 // the display mode.
29 class ASH_EXPORT DisplayConfiguratorAnimation
30     : public ui::DisplayConfigurator::Observer {
31  public:
32   DisplayConfiguratorAnimation();
33   virtual ~DisplayConfiguratorAnimation();
34
35   // Starts the fade-out animation for the all root windows.  It will
36   // call |callback| once all of the animations have finished.
37   void StartFadeOutAnimation(base::Closure callback);
38
39   // Starts the animation to clear the fade-out animation effect
40   // for the all root windows.
41   void StartFadeInAnimation();
42
43  protected:
44   // ui::DisplayConfigurator::Observer overrides:
45   virtual void OnDisplayModeChanged(
46       const ui::DisplayConfigurator::DisplayStateList& outputs) OVERRIDE;
47   virtual void OnDisplayModeChangeFailed(
48       ui::MultipleDisplayState failed_new_state) OVERRIDE;
49
50  private:
51   // Clears all hiding layers.  Note that in case that this method is called
52   // during an animation, the method call will cancel all of the animations
53   // and *not* call the registered callback.
54   void ClearHidingLayers();
55
56   std::map<aura::Window*, ui::Layer*> hiding_layers_;
57   scoped_ptr<base::OneShotTimer<DisplayConfiguratorAnimation> > timer_;
58
59   DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorAnimation);
60 };
61
62 }  // namespace ash
63
64 #endif  // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_