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

Unified Diff: ui/compositor/layer_animation_observer.cc

Issue 11453012: Fix black background when locking with fullscreen window: (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Mock TimeTicks::Now() Created 8 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 side-by-side diff with in-line comments
Download patch
Index: ui/compositor/layer_animation_observer.cc
diff --git a/ui/compositor/layer_animation_observer.cc b/ui/compositor/layer_animation_observer.cc
index 2d7402b5f1aee921dab7e68d8a1623b252299470..bb0771a476298f678d1cdb11d0d2e4a362fe4b3d 100644
--- a/ui/compositor/layer_animation_observer.cc
+++ b/ui/compositor/layer_animation_observer.cc
@@ -120,4 +120,113 @@ void ImplicitAnimationObserver::CheckCompleted() {
}
}
+////////////////////////////////////////////////////////////////////////////////
+// AnimationFinishedObserver
+
+AnimationFinishedObserver::AnimationFinishedObserver(
+ base::Callback<void(void)> &callback)
+ : callback_(callback),
+ sequences_attached_(0),
+ sequences_completed_(0),
+ paused_(false) {
+}
+
+AnimationFinishedObserver::~AnimationFinishedObserver() {
+}
+
+void AnimationFinishedObserver::Pause() {
+ paused_ = true;
+}
+
+void AnimationFinishedObserver::Unpause() {
+ if (!paused_)
+ return;
+ paused_ = false;
+ if (sequences_completed_ == sequences_attached_) {
+ callback_.Run();
+ delete this;
+ }
+}
+
+void AnimationFinishedObserver::OnLayerAnimationEnded(
+ ui::LayerAnimationSequence* seq) {
+ sequences_completed_++;
+ if ((sequences_completed_ == sequences_attached_) && !paused_) {
+ callback_.Run();
+ delete this;
+ }
+}
+
+void AnimationFinishedObserver::OnLayerAnimationAborted(
+ ui::LayerAnimationSequence* seq) {
+ sequences_completed_++;
+ if ((sequences_completed_ == sequences_attached_) && !paused_)
+ delete this;
+}
+
+void AnimationFinishedObserver::OnAttachedToSequence(
+ LayerAnimationSequence* sequence) {
+ LayerAnimationObserver::OnAttachedToSequence(sequence);
+ sequences_attached_++;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// AnimationAbortedObserver
+
+AnimationAbortedObserver::AnimationAbortedObserver(
+ base::Callback<void(void)> &callback)
+ : callback_(callback),
+ sequences_attached_(0),
+ sequences_completed_(0),
+ aborted_(false) {
+}
+
+AnimationAbortedObserver::~AnimationAbortedObserver() {
+ if (sequences_completed_ != sequences_attached_) {
+ if (aborted_)
+ callback_.Run();
+ }
+}
+
+void AnimationAbortedObserver::Pause() {
+ paused_ = true;
+}
+
+void AnimationAbortedObserver::Unpause() {
+ if (!paused_)
+ return;
+ paused_ = false;
+ if (sequences_completed_ == sequences_attached_) {
+ if (aborted_)
+ callback_.Run();
+ delete this;
+ }
+}
+
+void AnimationAbortedObserver::OnLayerAnimationEnded(
+ ui::LayerAnimationSequence* seq) {
+ sequences_completed_++;
+ if ((sequences_completed_ == sequences_attached_) && !paused_) {
+ if (aborted_)
+ callback_.Run();
+ delete this;
+ }
+}
+
+void AnimationAbortedObserver::OnLayerAnimationAborted(
+ ui::LayerAnimationSequence* seq) {
+ aborted_ = true;
+ sequences_completed_++;
+ if ((sequences_completed_ == sequences_attached_) && !paused_) {
+ callback_.Run();
+ delete this;
+ }
+}
+
+void AnimationAbortedObserver::OnAttachedToSequence(
+ LayerAnimationSequence* sequence) {
+ LayerAnimationObserver::OnAttachedToSequence(sequence);
+ sequences_attached_++;
+}
+
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698