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

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

Issue 10365007: ui: Move compositor/ directory out of gfx/, up to ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix DEPS Created 8 years, 7 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/gfx/compositor/layer_animation_observer.h"
6
7 #include "ui/gfx/compositor/layer_animation_sequence.h"
8
9 namespace ui {
10
11 ////////////////////////////////////////////////////////////////////////////////
12 // LayerAnimationObserver
13
14 LayerAnimationObserver::LayerAnimationObserver() {
15 }
16
17 LayerAnimationObserver::~LayerAnimationObserver() {
18 StopObserving();
19 }
20
21 bool LayerAnimationObserver::RequiresNotificationWhenAnimatorDestroyed() const {
22 return false;
23 }
24
25 void LayerAnimationObserver::OnAttachedToSequence(
26 LayerAnimationSequence* sequence) {
27 }
28
29 void LayerAnimationObserver::OnDetachedFromSequence(
30 LayerAnimationSequence* sequence) {
31 }
32
33 void LayerAnimationObserver::StopObserving() {
34 while (!attached_sequences_.empty()) {
35 LayerAnimationSequence* sequence = *attached_sequences_.begin();
36 sequence->RemoveObserver(this);
37 }
38 }
39
40 void LayerAnimationObserver::AttachedToSequence(
41 LayerAnimationSequence* sequence) {
42 DCHECK(attached_sequences_.find(sequence) == attached_sequences_.end());
43 attached_sequences_.insert(sequence);
44 OnAttachedToSequence(sequence);
45 }
46
47 void LayerAnimationObserver::DetachedFromSequence(
48 LayerAnimationSequence* sequence, bool send_notification) {
49 if (attached_sequences_.find(sequence) != attached_sequences_.end())
50 attached_sequences_.erase(sequence);
51 if (send_notification)
52 OnDetachedFromSequence(sequence);
53 }
54
55 ////////////////////////////////////////////////////////////////////////////////
56 // ImplicitAnimationObserver
57
58 ImplicitAnimationObserver::ImplicitAnimationObserver()
59 : active_(false) {
60 }
61
62 ImplicitAnimationObserver::~ImplicitAnimationObserver() {}
63
64 void ImplicitAnimationObserver::SetActive(bool active) {
65 active_ = active;
66 CheckCompleted();
67 }
68
69 void ImplicitAnimationObserver::StopObservingImplicitAnimations() {
70 SetActive(false);
71 StopObserving();
72 }
73
74 void ImplicitAnimationObserver::OnLayerAnimationEnded(
75 LayerAnimationSequence* sequence) {
76 sequence->RemoveObserver(this);
77 DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
78 CheckCompleted();
79 }
80
81 void ImplicitAnimationObserver::OnLayerAnimationAborted(
82 LayerAnimationSequence* sequence) {
83 sequence->RemoveObserver(this);
84 DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
85 CheckCompleted();
86 }
87
88 void ImplicitAnimationObserver::OnLayerAnimationScheduled(
89 LayerAnimationSequence* sequence) {
90 }
91
92 void ImplicitAnimationObserver::OnAttachedToSequence(
93 LayerAnimationSequence* sequence) {
94 }
95
96 void ImplicitAnimationObserver::OnDetachedFromSequence(
97 LayerAnimationSequence* sequence) {
98 DCHECK(attached_sequences().find(sequence) == attached_sequences().end());
99 CheckCompleted();
100 }
101
102 void ImplicitAnimationObserver::CheckCompleted() {
103 if (active_ && attached_sequences().empty()) {
104 OnImplicitAnimationsCompleted();
105 active_ = false;
106 }
107 }
108
109 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/compositor/layer_animation_observer.h ('k') | ui/gfx/compositor/layer_animation_sequence.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698