Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: ui/compositor/layer_animation_element.h

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Complete inclusion Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ANIMATION_ELEMENT_H_ 5 #ifndef UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 6 #define UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <set> 11 #include <set>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 15 #include "base/time/time.h"
15 #include "cc/animation/animation.h" 16 #include "cc/animation/animation.h"
16 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
17 #include "ui/compositor/compositor_export.h" 18 #include "ui/compositor/compositor_export.h"
18 #include "ui/gfx/animation/tween.h" 19 #include "ui/gfx/animation/tween.h"
19 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 64
64 typedef uint32_t AnimatableProperties; 65 typedef uint32_t AnimatableProperties;
65 66
66 LayerAnimationElement(AnimatableProperties properties, 67 LayerAnimationElement(AnimatableProperties properties,
67 base::TimeDelta duration); 68 base::TimeDelta duration);
68 69
69 virtual ~LayerAnimationElement(); 70 virtual ~LayerAnimationElement();
70 71
71 // Creates an element that transitions to the given transform. The caller owns 72 // Creates an element that transitions to the given transform. The caller owns
72 // the return value. 73 // the return value.
73 static LayerAnimationElement* CreateTransformElement( 74 static std::unique_ptr<LayerAnimationElement> CreateTransformElement(
74 const gfx::Transform& transform, 75 const gfx::Transform& transform,
75 base::TimeDelta duration); 76 base::TimeDelta duration);
76 77
77 // Creates an element that transitions to another in a way determined by an 78 // Creates an element that transitions to another in a way determined by an
78 // interpolated transform. The element accepts ownership of the interpolated 79 // interpolated transform. The element accepts ownership of the interpolated
79 // transform. NB: at every step, the interpolated transform clobbers the 80 // transform. NB: at every step, the interpolated transform clobbers the
80 // existing transform. That is, it does not interpolate between the existing 81 // existing transform. That is, it does not interpolate between the existing
81 // transform and the last value the interpolated transform will assume. It is 82 // transform and the last value the interpolated transform will assume. It is
82 // therefore important that the value of the interpolated at time 0 matches 83 // therefore important that the value of the interpolated at time 0 matches
83 // the current transform. 84 // the current transform.
84 static LayerAnimationElement* CreateInterpolatedTransformElement( 85 static std::unique_ptr<LayerAnimationElement>
85 InterpolatedTransform* interpolated_transform, 86 CreateInterpolatedTransformElement(
87 std::unique_ptr<InterpolatedTransform> interpolated_transform,
86 base::TimeDelta duration); 88 base::TimeDelta duration);
87 89
88 // Creates an element that transitions to the given bounds. The caller owns 90 // Creates an element that transitions to the given bounds. The caller owns
89 // the return value. 91 // the return value.
90 static LayerAnimationElement* CreateBoundsElement( 92 static std::unique_ptr<LayerAnimationElement> CreateBoundsElement(
91 const gfx::Rect& bounds, 93 const gfx::Rect& bounds,
92 base::TimeDelta duration); 94 base::TimeDelta duration);
93 95
94 // Creates an element that transitions to the given opacity. The caller owns 96 // Creates an element that transitions to the given opacity. The caller owns
95 // the return value. 97 // the return value.
96 static LayerAnimationElement* CreateOpacityElement( 98 static std::unique_ptr<LayerAnimationElement> CreateOpacityElement(
97 float opacity, 99 float opacity,
98 base::TimeDelta duration); 100 base::TimeDelta duration);
99 101
100 // Creates an element that sets visibily following a delay. The caller owns 102 // Creates an element that sets visibily following a delay. The caller owns
101 // the return value. 103 // the return value.
102 static LayerAnimationElement* CreateVisibilityElement( 104 static std::unique_ptr<LayerAnimationElement> CreateVisibilityElement(
103 bool visibility, 105 bool visibility,
104 base::TimeDelta duration); 106 base::TimeDelta duration);
105 107
106 // Creates an element that transitions to the given brightness. 108 // Creates an element that transitions to the given brightness.
107 // The caller owns the return value. 109 // The caller owns the return value.
108 static LayerAnimationElement* CreateBrightnessElement( 110 static std::unique_ptr<LayerAnimationElement> CreateBrightnessElement(
109 float brightness, 111 float brightness,
110 base::TimeDelta duration); 112 base::TimeDelta duration);
111 113
112 // Creates an element that transitions to the given grayscale value. 114 // Creates an element that transitions to the given grayscale value.
113 // The caller owns the return value. 115 // The caller owns the return value.
114 static LayerAnimationElement* CreateGrayscaleElement( 116 static std::unique_ptr<LayerAnimationElement> CreateGrayscaleElement(
115 float grayscale, 117 float grayscale,
116 base::TimeDelta duration); 118 base::TimeDelta duration);
117 119
118 // Creates an element that pauses the given properties. The caller owns the 120 // Creates an element that pauses the given properties. The caller owns the
119 // return value. 121 // return value.
120 static LayerAnimationElement* CreatePauseElement( 122 static std::unique_ptr<LayerAnimationElement> CreatePauseElement(
121 AnimatableProperties properties, 123 AnimatableProperties properties,
122 base::TimeDelta duration); 124 base::TimeDelta duration);
123 125
124 // Creates an element that transitions to the given color. The caller owns the 126 // Creates an element that transitions to the given color. The caller owns the
125 // return value. 127 // return value.
126 static LayerAnimationElement* CreateColorElement( 128 static std::unique_ptr<LayerAnimationElement> CreateColorElement(
127 SkColor color, 129 SkColor color,
128 base::TimeDelta duration); 130 base::TimeDelta duration);
129 131
130 // Sets the start time for the animation. This must be called before the first 132 // Sets the start time for the animation. This must be called before the first
131 // call to {Start, IsFinished}. Once the animation is finished, this must 133 // call to {Start, IsFinished}. Once the animation is finished, this must
132 // be called again in order to restart the animation. 134 // be called again in order to restart the animation.
133 void set_requested_start_time(base::TimeTicks start_time) { 135 void set_requested_start_time(base::TimeTicks start_time) {
134 requested_start_time_ = start_time; 136 requested_start_time_ = start_time;
135 } 137 }
136 base::TimeTicks requested_start_time() const { return requested_start_time_; } 138 base::TimeTicks requested_start_time() const { return requested_start_time_; }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 double last_progressed_fraction_; 229 double last_progressed_fraction_;
228 230
229 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_; 231 base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_;
230 232
231 DISALLOW_ASSIGN(LayerAnimationElement); 233 DISALLOW_ASSIGN(LayerAnimationElement);
232 }; 234 };
233 235
234 } // namespace ui 236 } // namespace ui
235 237
236 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_ 238 #endif // UI_COMPOSITOR_LAYER_ANIMATION_ELEMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698