OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ash/shelf/background_animator.h" | 5 #include "ash/shelf/background_animator.h" |
6 | 6 |
7 | 7 |
8 namespace ash { | 8 namespace ash { |
9 namespace internal { | 9 namespace internal { |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 animation_.SetSlideDuration(kBackgroundDurationMS); | 27 animation_.SetSlideDuration(kBackgroundDurationMS); |
28 } | 28 } |
29 | 29 |
30 BackgroundAnimator::~BackgroundAnimator() { | 30 BackgroundAnimator::~BackgroundAnimator() { |
31 } | 31 } |
32 | 32 |
33 void BackgroundAnimator::SetDuration(int time_in_ms) { | 33 void BackgroundAnimator::SetDuration(int time_in_ms) { |
34 animation_.SetSlideDuration(time_in_ms); | 34 animation_.SetSlideDuration(time_in_ms); |
35 } | 35 } |
36 | 36 |
37 void BackgroundAnimator::SetPaintsBackground(bool value, ChangeType type) { | 37 void BackgroundAnimator::SetPaintsBackground( |
| 38 bool value, BackgroundAnimatorChangeType type) { |
38 if (paints_background_ == value) | 39 if (paints_background_ == value) |
39 return; | 40 return; |
40 paints_background_ = value; | 41 paints_background_ = value; |
41 if (type == CHANGE_IMMEDIATE && !animation_.is_animating()) { | 42 if (type == BACKGROUND_CHANGE_IMMEDIATE && !animation_.is_animating()) { |
42 animation_.Reset(value ? 1.0f : 0.0f); | 43 animation_.Reset(value ? 1.0f : 0.0f); |
43 AnimationProgressed(&animation_); | 44 AnimationProgressed(&animation_); |
44 return; | 45 return; |
45 } | 46 } |
46 if (paints_background_) | 47 if (paints_background_) |
47 animation_.Show(); | 48 animation_.Show(); |
48 else | 49 else |
49 animation_.Hide(); | 50 animation_.Hide(); |
50 } | 51 } |
51 | 52 |
52 void BackgroundAnimator::AnimationProgressed(const gfx::Animation* animation) { | 53 void BackgroundAnimator::AnimationProgressed(const gfx::Animation* animation) { |
53 int alpha = animation->CurrentValueBetween(min_alpha_, max_alpha_); | 54 int alpha = animation->CurrentValueBetween(min_alpha_, max_alpha_); |
54 if (alpha_ == alpha) | 55 if (alpha_ == alpha) |
55 return; | 56 return; |
56 alpha_ = alpha; | 57 alpha_ = alpha; |
57 delegate_->UpdateBackground(alpha_); | 58 delegate_->UpdateBackground(alpha_); |
58 } | 59 } |
59 | 60 |
60 } // namespace internal | 61 } // namespace internal |
61 } // namespace ash | 62 } // namespace ash |
OLD | NEW |