OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | 5 #ifndef UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ |
6 #define UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | 6 #define UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 | 12 |
13 #include "ui/gfx/compositor/compositor_export.h" | 13 #include "ui/gfx/compositor/compositor_export.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 class ImplicitAnimationObserver; | 17 class ImplicitAnimationObserver; |
18 class LayerAnimator; | 18 class LayerAnimator; |
19 class LayerAnimationObserver; | 19 class LayerAnimationObserver; |
20 | 20 |
21 // Scoped settings allow you to temporarily change the animator's settings and | 21 // Scoped settings allow you to temporarily change the animator's settings and |
22 // these changes are reverted when the object is destroyed. NOTE: when the | 22 // these changes are reverted when the object is destroyed. NOTE: when the |
23 // settings object is created, it applies the default transition duration | 23 // settings object is created, it applies the default transition duration |
24 // (200ms). | 24 // (200ms). |
25 class COMPOSITOR_EXPORT ScopedLayerAnimationSettings { | 25 class COMPOSITOR_EXPORT ScopedLayerAnimationSettings { |
26 public: | 26 public: |
27 explicit ScopedLayerAnimationSettings(LayerAnimator* animator); | 27 explicit ScopedLayerAnimationSettings(LayerAnimator* animator); |
28 virtual ~ScopedLayerAnimationSettings(); | 28 virtual ~ScopedLayerAnimationSettings(); |
29 | 29 |
30 void AddObserver(ImplicitAnimationObserver* observer); | 30 void AddObserver(LayerAnimationObserver* observer); |
| 31 void AddImplicitObserver(ImplicitAnimationObserver* observer); |
31 void SetTransitionDuration(base::TimeDelta duration); | 32 void SetTransitionDuration(base::TimeDelta duration); |
32 | 33 |
33 private: | 34 private: |
34 LayerAnimator* animator_; | 35 LayerAnimator* animator_; |
35 base::TimeDelta old_transition_duration_; | 36 base::TimeDelta old_transition_duration_; |
36 std::set<ImplicitAnimationObserver*> observers_; | 37 std::set<LayerAnimationObserver*> observers_; |
| 38 std::set<ImplicitAnimationObserver*> implicit_observers_; |
37 | 39 |
38 DISALLOW_COPY_AND_ASSIGN(ScopedLayerAnimationSettings); | 40 DISALLOW_COPY_AND_ASSIGN(ScopedLayerAnimationSettings); |
39 }; | 41 }; |
40 | 42 |
41 } // namespace ui | 43 } // namespace ui |
42 | 44 |
43 #endif // UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | 45 #endif // UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ |
OLD | NEW |