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 #include "ui/compositor/layer_animation_sequence.h" | 5 #include "ui/compositor/layer_animation_sequence.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 observers_, | 41 observers_, |
42 DetachedFromSequence(this, true)); | 42 DetachedFromSequence(this, true)); |
43 } | 43 } |
44 | 44 |
45 void LayerAnimationSequence::Start(LayerAnimationDelegate* delegate) { | 45 void LayerAnimationSequence::Start(LayerAnimationDelegate* delegate) { |
46 DCHECK(start_time_ != base::TimeTicks()); | 46 DCHECK(start_time_ != base::TimeTicks()); |
47 last_progressed_fraction_ = 0.0; | 47 last_progressed_fraction_ = 0.0; |
48 if (elements_.empty()) | 48 if (elements_.empty()) |
49 return; | 49 return; |
50 | 50 |
| 51 NotifyStarted(); |
| 52 |
51 elements_[0]->set_requested_start_time(start_time_); | 53 elements_[0]->set_requested_start_time(start_time_); |
52 elements_[0]->Start(delegate, animation_group_id_); | 54 elements_[0]->Start(delegate, animation_group_id_); |
53 } | 55 } |
54 | 56 |
55 void LayerAnimationSequence::Progress(base::TimeTicks now, | 57 void LayerAnimationSequence::Progress(base::TimeTicks now, |
56 LayerAnimationDelegate* delegate) { | 58 LayerAnimationDelegate* delegate) { |
57 DCHECK(start_time_ != base::TimeTicks()); | 59 DCHECK(start_time_ != base::TimeTicks()); |
58 bool redraw_required = false; | 60 bool redraw_required = false; |
59 | 61 |
60 if (elements_.empty()) | 62 if (elements_.empty()) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 253 |
252 return elements_[0].get(); | 254 return elements_[0].get(); |
253 } | 255 } |
254 | 256 |
255 void LayerAnimationSequence::NotifyScheduled() { | 257 void LayerAnimationSequence::NotifyScheduled() { |
256 FOR_EACH_OBSERVER(LayerAnimationObserver, | 258 FOR_EACH_OBSERVER(LayerAnimationObserver, |
257 observers_, | 259 observers_, |
258 OnLayerAnimationScheduled(this)); | 260 OnLayerAnimationScheduled(this)); |
259 } | 261 } |
260 | 262 |
| 263 void LayerAnimationSequence::NotifyStarted() { |
| 264 FOR_EACH_OBSERVER(LayerAnimationObserver, observers_, |
| 265 OnLayerAnimationStarted(this)); |
| 266 } |
| 267 |
261 void LayerAnimationSequence::NotifyEnded() { | 268 void LayerAnimationSequence::NotifyEnded() { |
262 FOR_EACH_OBSERVER(LayerAnimationObserver, | 269 FOR_EACH_OBSERVER(LayerAnimationObserver, |
263 observers_, | 270 observers_, |
264 OnLayerAnimationEnded(this)); | 271 OnLayerAnimationEnded(this)); |
265 } | 272 } |
266 | 273 |
267 void LayerAnimationSequence::NotifyAborted() { | 274 void LayerAnimationSequence::NotifyAborted() { |
268 FOR_EACH_OBSERVER(LayerAnimationObserver, | 275 FOR_EACH_OBSERVER(LayerAnimationObserver, |
269 observers_, | 276 observers_, |
270 OnLayerAnimationAborted(this)); | 277 OnLayerAnimationAborted(this)); |
271 } | 278 } |
272 | 279 |
273 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { | 280 LayerAnimationElement* LayerAnimationSequence::CurrentElement() const { |
274 if (elements_.empty()) | 281 if (elements_.empty()) |
275 return NULL; | 282 return NULL; |
276 | 283 |
277 size_t current_index = last_element_ % elements_.size(); | 284 size_t current_index = last_element_ % elements_.size(); |
278 return elements_[current_index].get(); | 285 return elements_[current_index].get(); |
279 } | 286 } |
280 | 287 |
281 } // namespace ui | 288 } // namespace ui |
OLD | NEW |