Index: ui/views/controls/button/custom_button.cc |
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc |
index 76525064a7e34ab110e46752ecb27228656ec21a..62fec14cbce91d26834649fe869231a99e9dbf97 100644 |
--- a/ui/views/controls/button/custom_button.cc |
+++ b/ui/views/controls/button/custom_button.cc |
@@ -62,21 +62,21 @@ void CustomButton::SetState(ButtonState state) { |
return; |
if (animate_on_state_change_ && |
- (!is_throbbing_ || !hover_animation_->is_animating())) { |
+ (!is_throbbing_ || !hover_animation_.is_animating())) { |
is_throbbing_ = false; |
if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) { |
// For HOVERED -> NORMAL, animate from hovered (1) to not hovered (0). |
- hover_animation_->Hide(); |
+ hover_animation_.Hide(); |
} else if (state != STATE_HOVERED) { |
// For HOVERED -> PRESSED/DISABLED, or any transition not involving |
// HOVERED at all, simply set the state to not hovered (0). |
- hover_animation_->Reset(); |
+ hover_animation_.Reset(); |
} else if (state_ == STATE_NORMAL) { |
// For NORMAL -> HOVERED, animate from not hovered (0) to hovered (1). |
- hover_animation_->Show(); |
+ hover_animation_.Show(); |
} else { |
// For PRESSED/DISABLED -> HOVERED, simply set the state to hovered (1). |
- hover_animation_->Reset(1); |
+ hover_animation_.Reset(1); |
} |
} |
@@ -87,18 +87,18 @@ void CustomButton::SetState(ButtonState state) { |
void CustomButton::StartThrobbing(int cycles_til_stop) { |
is_throbbing_ = true; |
- hover_animation_->StartThrobbing(cycles_til_stop); |
+ hover_animation_.StartThrobbing(cycles_til_stop); |
} |
void CustomButton::StopThrobbing() { |
- if (hover_animation_->is_animating()) { |
- hover_animation_->Stop(); |
+ if (hover_animation_.is_animating()) { |
+ hover_animation_.Stop(); |
SchedulePaint(); |
} |
} |
void CustomButton::SetAnimationDuration(int duration) { |
- hover_animation_->SetSlideDuration(duration); |
+ hover_animation_.SetSlideDuration(duration); |
} |
void CustomButton::SetHotTracked(bool is_hot_tracked) { |
@@ -243,7 +243,7 @@ void CustomButton::OnGestureEvent(ui::GestureEvent* event) { |
// STATE_NORMAL beginning the fade out animation. See |
// http://crbug.com/131184. |
SetState(STATE_HOVERED); |
- hover_animation_->Reset(1.0); |
+ hover_animation_.Reset(1.0); |
NotifyClick(*event); |
event->StopPropagation(); |
} else if (event->type() == ui::ET_GESTURE_TAP_DOWN && |
@@ -336,6 +336,7 @@ void CustomButton::AnimationProgressed(const gfx::Animation* animation) { |
CustomButton::CustomButton(ButtonListener* listener) |
: Button(listener), |
state_(STATE_NORMAL), |
+ hover_animation_(this), |
animate_on_state_change_(true), |
is_throbbing_(false), |
triggerable_event_flags_(ui::EF_LEFT_MOUSE_BUTTON), |
@@ -344,8 +345,7 @@ CustomButton::CustomButton(ButtonListener* listener) |
notify_action_(NOTIFY_ON_RELEASE), |
has_ink_drop_action_on_click_(false), |
ink_drop_action_on_click_(InkDropState::QUICK_ACTION) { |
- hover_animation_.reset(new gfx::ThrobAnimation(this)); |
- hover_animation_->SetSlideDuration(kHoverFadeDurationMs); |
+ hover_animation_.SetSlideDuration(kHoverFadeDurationMs); |
} |
void CustomButton::StateChanged() { |