Commit d8f67e12 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Do not play animations for non-focused users.

Bug: 872923
Change-Id: I7071921895fcd017a65286fce4b565ad8f96de76
Reviewed-on: https://chromium-review.googlesource.com/1170035
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarXiaoyin Hu <xiaoyinh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582245}
parent 45d9e339
......@@ -24,7 +24,7 @@ class AnimatedRoundedImageView : public views::View {
enum class Playback {
kFirstFrameOnly, // Only the first frame in the animation will be shown.
kSingle, // Play the animation only once.
kRepeat, // Play the animation repeatly.
kRepeat, // Play the animation repeatedly.
};
// Provides animation frames.
......@@ -49,6 +49,9 @@ class AnimatedRoundedImageView : public views::View {
// Set playback type of the animation.
void SetAnimationPlayback(Playback playback);
// Get the current type of animation playback.
Playback playback() const { return playback_; }
// views::View:
gfx::Size CalculatePreferredSize() const override;
void OnPaint(gfx::Canvas* canvas) override;
......
......@@ -153,9 +153,10 @@ class LoginUserView::UserImage : public NonAccessibleView {
return;
}
// Don't change the playback style which was set in SetAnimationEnabled.
image_->SetAnimationDecoder(
std::make_unique<PassthroughAnimationDecoder>(animation),
AnimatedRoundedImageView::Playback::kRepeat);
image_->playback());
}
AnimatedRoundedImageView* image_ = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment