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

Unified Diff: ui/gfx/animation/slide_animation.cc

Issue 2679333002: [ash-md] Remove the number of animators used for the Shelf animations. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/animation/slide_animation.cc
diff --git a/ui/gfx/animation/slide_animation.cc b/ui/gfx/animation/slide_animation.cc
index 780e8ec8b0fa70593b13042edc5b228484e067d2..e410935cbd520fb09313e5c7b882b1de5b2bdab7 100644
--- a/ui/gfx/animation/slide_animation.cc
+++ b/ui/gfx/animation/slide_animation.cc
@@ -6,6 +6,9 @@
#include <math.h>
+#include "base/auto_reset.h"
+#include "ui/gfx/animation/animation_delegate.h"
+
namespace gfx {
// How long animations should take by default.
@@ -46,6 +49,8 @@ void SlideAnimation::Show() {
// Make sure we actually have something to do.
if (slide_duration_ == 0) {
AnimateToState(1.0); // Skip to the end of the animation.
+ if (delegate())
+ delegate()->AnimationProgressed(this);
James Cook 2017/02/08 00:31:28 Do you know offhand if any of Chrome's other users
bruthig 2017/02/10 18:49:10 I did a quick audit and it appears there might be
return;
} else if (value_current_ == value_end_) {
return;
@@ -56,6 +61,11 @@ void SlideAnimation::Show() {
Start();
}
+void SlideAnimation::ShowImmediately() {
+ base::AutoReset<int> auto_reset_duration(&slide_duration_, 0);
+ Show();
+}
+
void SlideAnimation::Hide() {
// If we're already hiding (or hidden), we have nothing to do.
if (!showing_)
@@ -67,7 +77,9 @@ void SlideAnimation::Hide() {
// Make sure we actually have something to do.
if (slide_duration_ == 0) {
- AnimateToState(0.0); // Skip to the end of the animation.
+ AnimateToState(1.0); // Skip to the end of the animation.
+ if (delegate())
+ delegate()->AnimationProgressed(this);
return;
} else if (value_current_ == value_end_) {
return;
@@ -78,6 +90,11 @@ void SlideAnimation::Hide() {
Start();
}
+void SlideAnimation::HideImmediately() {
+ base::AutoReset<int> auto_reset_duration(&slide_duration_, 0);
+ Hide();
+}
+
void SlideAnimation::SetSlideDuration(int duration) {
slide_duration_ = duration;
}

Powered by Google App Engine
This is Rietveld 408576698