OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | |
6 #define UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | |
7 #pragma once | |
8 | |
9 #include <set> | |
10 | |
11 #include "base/time.h" | |
12 | |
13 #include "ui/base/animation/tween.h" | |
14 #include "ui/gfx/compositor/compositor_export.h" | |
15 #include "ui/gfx/compositor/layer_animator.h" | |
16 | |
17 namespace ui { | |
18 | |
19 class ImplicitAnimationObserver; | |
20 class LayerAnimationObserver; | |
21 | |
22 // Scoped settings allow you to temporarily change the animator's settings and | |
23 // these changes are reverted when the object is destroyed. NOTE: when the | |
24 // settings object is created, it applies the default transition duration | |
25 // (200ms). | |
26 class COMPOSITOR_EXPORT ScopedLayerAnimationSettings { | |
27 public: | |
28 explicit ScopedLayerAnimationSettings(LayerAnimator* animator); | |
29 virtual ~ScopedLayerAnimationSettings(); | |
30 | |
31 void AddObserver(ImplicitAnimationObserver* observer); | |
32 | |
33 void SetTransitionDuration(base::TimeDelta duration); | |
34 base::TimeDelta GetTransitionDuration() const; | |
35 | |
36 void SetTweenType(Tween::Type tween_type); | |
37 Tween::Type GetTweenType() const; | |
38 | |
39 void SetPreemptionStrategy(LayerAnimator::PreemptionStrategy strategy); | |
40 LayerAnimator::PreemptionStrategy GetPreemptionStrategy() const; | |
41 | |
42 private: | |
43 LayerAnimator* animator_; | |
44 base::TimeDelta old_transition_duration_; | |
45 Tween::Type old_tween_type_; | |
46 LayerAnimator::PreemptionStrategy old_preemption_strategy_; | |
47 std::set<ImplicitAnimationObserver*> observers_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(ScopedLayerAnimationSettings); | |
50 }; | |
51 | |
52 } // namespace ui | |
53 | |
54 #endif // UI_GFX_COMPOSITOR_SCOPED_LAYER_ANIMATION_SETTINGS_H_ | |
OLD | NEW |