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

Side by Side Diff: ui/gfx/compositor/layer_animation_sequence.cc

Issue 8395046: Allows observers to be notified when layer animations complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge with master Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/compositor/layer_animation_sequence.h" 5 #include "ui/gfx/compositor/layer_animation_sequence.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "ui/gfx/compositor/layer_animation_delegate.h" 11 #include "ui/gfx/compositor/layer_animation_delegate.h"
12 #include "ui/gfx/compositor/layer_animation_element.h" 12 #include "ui/gfx/compositor/layer_animation_element.h"
13 #include "ui/gfx/compositor/layer_animation_observer.h"
13 14
14 namespace ui { 15 namespace ui {
15 16
16 LayerAnimationSequence::LayerAnimationSequence() 17 LayerAnimationSequence::LayerAnimationSequence()
17 : is_cyclic_(false), 18 : is_cyclic_(false),
18 last_element_(0) { 19 last_element_(0) {
19 } 20 }
20 21
21 LayerAnimationSequence::LayerAnimationSequence(LayerAnimationElement* element) 22 LayerAnimationSequence::LayerAnimationSequence(LayerAnimationElement* element)
22 : is_cyclic_(false), 23 : is_cyclic_(false),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const LayerAnimationElement::AnimatableProperties& other) const { 100 const LayerAnimationElement::AnimatableProperties& other) const {
100 LayerAnimationElement::AnimatableProperties intersection; 101 LayerAnimationElement::AnimatableProperties intersection;
101 std::insert_iterator<LayerAnimationElement::AnimatableProperties> ii( 102 std::insert_iterator<LayerAnimationElement::AnimatableProperties> ii(
102 intersection, intersection.begin()); 103 intersection, intersection.begin());
103 std::set_intersection(properties_.begin(), properties_.end(), 104 std::set_intersection(properties_.begin(), properties_.end(),
104 other.begin(), other.end(), 105 other.begin(), other.end(),
105 ii); 106 ii);
106 return intersection.size() > 0; 107 return intersection.size() > 0;
107 } 108 }
108 109
110 void LayerAnimationSequence::AddObserver(LayerAnimationObserver* observer) {
111 if (!observers_.HasObserver(observer))
112 observers_.AddObserver(observer);
113 }
114
115 void LayerAnimationSequence::RemoveObserver(LayerAnimationObserver* observer) {
116 observers_.RemoveObserver(observer);
117 }
118
119 void LayerAnimationSequence::NotifyEnded() {
120 FOR_EACH_OBSERVER(LayerAnimationObserver,
121 observers_,
122 OnLayerAnimationEnded(this));
123 }
124
109 } // namespace ui 125 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698