Add screen space opacity to opacity tree
[chromium-blink-merge.git] / ash / display / display_configurator_animation.h
blob0c25b14ec0a84d1735dab8d76a566afb793bc975
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.
5 #ifndef ASH_DISPLAY_DISPLAY_CONFIGURATOR_ANIMATION_H_
6 #define ASH_DISPLAY_DISPLAY_CONFIGURATOR_ANIMATION_H_
8 #include <map>
10 #include "ash/ash_export.h"
11 #include "base/callback.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/timer/timer.h"
14 #include "ui/display/chromeos/display_configurator.h"
16 namespace aura {
17 class RootWindow;
18 class Window;
19 } // namespace aura
21 namespace ui {
22 class Layer;
23 } // namespace ui
25 namespace ash {
27 // DisplayConfiguratorAnimation provides the visual effects for
28 // ui::DisplayConfigurator, such like fade-out/in during changing
29 // the display mode.
30 class ASH_EXPORT DisplayConfiguratorAnimation
31 : public ui::DisplayConfigurator::Observer {
32 public:
33 DisplayConfiguratorAnimation();
34 ~DisplayConfiguratorAnimation() override;
36 // Starts the fade-out animation for the all root windows. It will
37 // call |callback| once all of the animations have finished.
38 void StartFadeOutAnimation(base::Closure callback);
40 // Starts the animation to clear the fade-out animation effect
41 // for the all root windows.
42 void StartFadeInAnimation();
44 protected:
45 // ui::DisplayConfigurator::Observer overrides:
46 void OnDisplayModeChanged(
47 const ui::DisplayConfigurator::DisplayStateList& outputs) override;
48 void OnDisplayModeChangeFailed(
49 const ui::DisplayConfigurator::DisplayStateList& displays,
50 ui::MultipleDisplayState failed_new_state) override;
52 private:
53 // Clears all hiding layers. Note that in case that this method is called
54 // during an animation, the method call will cancel all of the animations
55 // and *not* call the registered callback.
56 void ClearHidingLayers();
58 std::map<aura::Window*, ui::Layer*> hiding_layers_;
59 scoped_ptr<base::OneShotTimer<DisplayConfiguratorAnimation> > timer_;
60 base::WeakPtrFactory<DisplayConfiguratorAnimation> weak_ptr_factory_;
62 DISALLOW_COPY_AND_ASSIGN(DisplayConfiguratorAnimation);
65 } // namespace ash
67 #endif // ASH_DISPLAY_DISPLAY_CONFIGURATION_CONTROLLER_H_