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

Side by Side Diff: cc/animation/layer_animation_controller.h

Issue 95763002: cc: Support animating scroll offset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 12 matching lines...) Expand all
23 } 23 }
24 24
25 namespace cc { 25 namespace cc {
26 26
27 class Animation; 27 class Animation;
28 class AnimationDelegate; 28 class AnimationDelegate;
29 class AnimationRegistrar; 29 class AnimationRegistrar;
30 class FilterOperations; 30 class FilterOperations;
31 class KeyframeValueList; 31 class KeyframeValueList;
32 class LayerAnimationValueObserver; 32 class LayerAnimationValueObserver;
33 class LayerAnimationValueProvider;
33 34
34 class CC_EXPORT LayerAnimationController 35 class CC_EXPORT LayerAnimationController
35 : public base::RefCounted<LayerAnimationController> { 36 : public base::RefCounted<LayerAnimationController> {
36 public: 37 public:
37 static scoped_refptr<LayerAnimationController> Create(int id); 38 static scoped_refptr<LayerAnimationController> Create(int id);
38 39
39 int id() const { return id_; } 40 int id() const { return id_; }
40 41
41 void AddAnimation(scoped_ptr<Animation> animation); 42 void AddAnimation(scoped_ptr<Animation> animation);
42 void PauseAnimation(int animation_id, double time_offset); 43 void PauseAnimation(int animation_id, double time_offset);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 double wall_clock_time); 89 double wall_clock_time);
89 void NotifyAnimationAborted(const AnimationEvent& event); 90 void NotifyAnimationAborted(const AnimationEvent& event);
90 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); 91 void NotifyAnimationPropertyUpdate(const AnimationEvent& event);
91 92
92 void AddValueObserver(LayerAnimationValueObserver* observer); 93 void AddValueObserver(LayerAnimationValueObserver* observer);
93 void RemoveValueObserver(LayerAnimationValueObserver* observer); 94 void RemoveValueObserver(LayerAnimationValueObserver* observer);
94 95
95 void AddEventObserver(LayerAnimationEventObserver* observer); 96 void AddEventObserver(LayerAnimationEventObserver* observer);
96 void RemoveEventObserver(LayerAnimationEventObserver* observer); 97 void RemoveEventObserver(LayerAnimationEventObserver* observer);
97 98
99 void set_value_provider(LayerAnimationValueProvider* provider) {
100 value_provider_ = provider;
101 }
102
103 void remove_value_provider(LayerAnimationValueProvider* provider) {
Ian Vollick 2013/11/29 15:29:29 Why not just set_value_provider(NULL)?
ajuma 2013/11/29 21:18:41 The issue is that a LayerImpl might not know wheth
Ian Vollick 2013/12/02 21:23:32 Thanks for the explanation.
104 if (value_provider_ == provider)
105 value_provider_ = NULL;
106 }
107
98 void set_layer_animation_delegate(AnimationDelegate* delegate) { 108 void set_layer_animation_delegate(AnimationDelegate* delegate) {
99 layer_animation_delegate_ = delegate; 109 layer_animation_delegate_ = delegate;
100 } 110 }
101 111
102 bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds); 112 bool AnimatedBoundsForBox(const gfx::BoxF& box, gfx::BoxF* bounds);
103 113
104 protected: 114 protected:
105 friend class base::RefCounted<LayerAnimationController>; 115 friend class base::RefCounted<LayerAnimationController>;
106 116
107 explicit LayerAnimationController(int id); 117 explicit LayerAnimationController(int id);
(...skipping 21 matching lines...) Expand all
129 139
130 enum UpdateActivationType { 140 enum UpdateActivationType {
131 NormalActivation, 141 NormalActivation,
132 ForceActivation 142 ForceActivation
133 }; 143 };
134 void UpdateActivation(UpdateActivationType type); 144 void UpdateActivation(UpdateActivationType type);
135 145
136 void NotifyObserversOpacityAnimated(float opacity); 146 void NotifyObserversOpacityAnimated(float opacity);
137 void NotifyObserversTransformAnimated(const gfx::Transform& transform); 147 void NotifyObserversTransformAnimated(const gfx::Transform& transform);
138 void NotifyObserversFilterAnimated(const FilterOperations& filter); 148 void NotifyObserversFilterAnimated(const FilterOperations& filter);
149 void NotifyObserversScrollOffsetAnimated(gfx::Vector2dF scroll_offset);
139 150
140 void NotifyObserversAnimationWaitingForDeletion(); 151 void NotifyObserversAnimationWaitingForDeletion();
141 152
142 bool HasValueObserver(); 153 bool HasValueObserver();
143 bool HasActiveValueObserver(); 154 bool HasActiveValueObserver();
144 155
145 AnimationRegistrar* registrar_; 156 AnimationRegistrar* registrar_;
146 int id_; 157 int id_;
147 ScopedPtrVector<Animation> active_animations_; 158 ScopedPtrVector<Animation> active_animations_;
148 159
149 // This is used to ensure that we don't spam the registrar. 160 // This is used to ensure that we don't spam the registrar.
150 bool is_active_; 161 bool is_active_;
151 162
152 double last_tick_time_; 163 double last_tick_time_;
153 164
154 ObserverList<LayerAnimationValueObserver> value_observers_; 165 ObserverList<LayerAnimationValueObserver> value_observers_;
155 ObserverList<LayerAnimationEventObserver> event_observers_; 166 ObserverList<LayerAnimationEventObserver> event_observers_;
156 167
168 LayerAnimationValueProvider* value_provider_;
169
157 AnimationDelegate* layer_animation_delegate_; 170 AnimationDelegate* layer_animation_delegate_;
158 171
159 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 172 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
160 }; 173 };
161 174
162 } // namespace cc 175 } // namespace cc
163 176
164 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 177 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698