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_COMPOSITOR_LAYER_ANIMATOR_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 6 #define UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "ui/base/animation/animation_container_element.h" | 16 #include "ui/base/animation/animation_container_element.h" |
17 #include "ui/base/animation/tween.h" | 17 #include "ui/base/animation/tween.h" |
18 #include "ui/compositor/compositor_export.h" | 18 #include "ui/compositor/compositor_export.h" |
19 #include "ui/compositor/layer_animation_element.h" | 19 #include "ui/compositor/layer_animation_element.h" |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 class Rect; | 22 class Rect; |
| 23 class Transform; |
23 } | 24 } |
24 | 25 |
25 namespace ui { | 26 namespace ui { |
26 class Animation; | 27 class Animation; |
27 class Layer; | 28 class Layer; |
28 class LayerAnimationSequence; | 29 class LayerAnimationSequence; |
29 class LayerAnimationDelegate; | 30 class LayerAnimationDelegate; |
30 class LayerAnimationObserver; | 31 class LayerAnimationObserver; |
31 class ScopedLayerAnimationSettings; | 32 class ScopedLayerAnimationSettings; |
32 class Transform; | |
33 | 33 |
34 // When a property of layer needs to be changed it is set by way of | 34 // When a property of layer needs to be changed it is set by way of |
35 // LayerAnimator. This enables LayerAnimator to animate property changes. | 35 // LayerAnimator. This enables LayerAnimator to animate property changes. |
36 // NB: during many tests, set_disable_animations_for_test is used and causes | 36 // NB: during many tests, set_disable_animations_for_test is used and causes |
37 // all animations to complete immediately. The layer animation is ref counted | 37 // all animations to complete immediately. The layer animation is ref counted |
38 // so that if its owning layer is deleted (and the owning layer is only other | 38 // so that if its owning layer is deleted (and the owning layer is only other |
39 // class that should ever hold a ref ptr to a LayerAnimator), the animator can | 39 // class that should ever hold a ref ptr to a LayerAnimator), the animator can |
40 // ensure that it is not disposed of until it finishes executing. It does this | 40 // ensure that it is not disposed of until it finishes executing. It does this |
41 // by holding a reference to itself for the duration of methods for which it | 41 // by holding a reference to itself for the duration of methods for which it |
42 // must guarantee that |this| is valid. | 42 // must guarantee that |this| is valid. |
(...skipping 10 matching lines...) Expand all Loading... |
53 | 53 |
54 explicit LayerAnimator(base::TimeDelta transition_duration); | 54 explicit LayerAnimator(base::TimeDelta transition_duration); |
55 | 55 |
56 // No implicit animations when properties are set. | 56 // No implicit animations when properties are set. |
57 static LayerAnimator* CreateDefaultAnimator(); | 57 static LayerAnimator* CreateDefaultAnimator(); |
58 | 58 |
59 // Implicitly animates when properties are set. | 59 // Implicitly animates when properties are set. |
60 static LayerAnimator* CreateImplicitAnimator(); | 60 static LayerAnimator* CreateImplicitAnimator(); |
61 | 61 |
62 // Sets the transform on the delegate. May cause an implicit animation. | 62 // Sets the transform on the delegate. May cause an implicit animation. |
63 virtual void SetTransform(const Transform& transform); | 63 virtual void SetTransform(const gfx::Transform& transform); |
64 Transform GetTargetTransform() const; | 64 gfx::Transform GetTargetTransform() const; |
65 | 65 |
66 // Sets the bounds on the delegate. May cause an implicit animation. | 66 // Sets the bounds on the delegate. May cause an implicit animation. |
67 virtual void SetBounds(const gfx::Rect& bounds); | 67 virtual void SetBounds(const gfx::Rect& bounds); |
68 gfx::Rect GetTargetBounds() const; | 68 gfx::Rect GetTargetBounds() const; |
69 | 69 |
70 // Sets the opacity on the delegate. May cause an implicit animation. | 70 // Sets the opacity on the delegate. May cause an implicit animation. |
71 virtual void SetOpacity(float opacity); | 71 virtual void SetOpacity(float opacity); |
72 float GetTargetOpacity() const; | 72 float GetTargetOpacity() const; |
73 | 73 |
74 // Sets the visibility of the delegate. May cause an implicit animation. | 74 // Sets the visibility of the delegate. May cause an implicit animation. |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // Observers are notified when layer animations end, are scheduled or are | 331 // Observers are notified when layer animations end, are scheduled or are |
332 // aborted. | 332 // aborted. |
333 ObserverList<LayerAnimationObserver> observers_; | 333 ObserverList<LayerAnimationObserver> observers_; |
334 | 334 |
335 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); | 335 DISALLOW_COPY_AND_ASSIGN(LayerAnimator); |
336 }; | 336 }; |
337 | 337 |
338 } // namespace ui | 338 } // namespace ui |
339 | 339 |
340 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ | 340 #endif // UI_COMPOSITOR_LAYER_ANIMATOR_H_ |
OLD | NEW |