OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_DISPLAY_DISPLAY_ANIMATOR_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_ANIMATOR_H_ |
6 #define ASH_DISPLAY_DISPLAY_ANIMATOR_H_ | 6 #define ASH_DISPLAY_DISPLAY_ANIMATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/macros.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/timer/timer.h" | |
15 #include "ui/display/chromeos/display_configurator.h" | |
16 | |
17 namespace aura { | |
18 class RootWindow; | |
19 class Window; | |
20 } // namespace aura | |
21 | |
22 namespace ui { | |
23 class Layer; | |
24 } // namespace ui | |
25 | 12 |
26 namespace ash { | 13 namespace ash { |
27 | 14 |
28 // DisplayAnimator provides the visual effects for | 15 // Interface class for animating display changes. |
29 // ui::DisplayConfigurator, such like fade-out/in during changing | 16 class ASH_EXPORT DisplayAnimator { |
30 // the display mode. | |
31 class ASH_EXPORT DisplayAnimator : public ui::DisplayConfigurator::Observer { | |
32 public: | 17 public: |
33 DisplayAnimator(); | 18 virtual ~DisplayAnimator() {} |
34 ~DisplayAnimator() override; | |
35 | 19 |
36 // Starts the fade-out animation for the all root windows. It will | 20 // Starts the fade-out animation for the all root windows. It will |
37 // call |callback| once all of the animations have finished. | 21 // call |callback| once all of the animations have finished. |
38 void StartFadeOutAnimation(base::Closure callback); | 22 virtual void StartFadeOutAnimation(base::Closure callback) = 0; |
39 | 23 |
40 // Starts the animation to clear the fade-out animation effect | 24 // Starts the animation to clear the fade-out animation effect |
41 // for the all root windows. | 25 // for the all root windows. |
42 void StartFadeInAnimation(); | 26 virtual void StartFadeInAnimation() = 0; |
43 | |
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; | |
51 | 27 |
52 private: | 28 private: |
53 // Clears all hiding layers. Note that in case that this method is called | 29 DISALLOW_ASSIGN(DisplayAnimator); |
54 // during an animation, the method call will cancel all of the animations | |
55 // and *not* call the registered callback. | |
56 void ClearHidingLayers(); | |
57 | |
58 std::map<aura::Window*, ui::Layer*> hiding_layers_; | |
59 scoped_ptr<base::OneShotTimer> timer_; | |
60 base::WeakPtrFactory<DisplayAnimator> weak_ptr_factory_; | |
61 | |
62 DISALLOW_COPY_AND_ASSIGN(DisplayAnimator); | |
63 }; | 30 }; |
64 | 31 |
65 } // namespace ash | 32 } // namespace ash |
66 | 33 |
67 #endif // ASH_DISPLAY_DISPLAY_ANIMATOR_H_ | 34 #endif // ASH_DISPLAY_DISPLAY_ANIMATOR_H_ |
OLD | NEW |