| Index: cc/input/top_controls_manager.cc
|
| diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
|
| index 971ba0cbe5a1d0c56647622be75a7604295ad824..8ac642b2a0b3c732f2f2406f9eb775357e72ef1d 100644
|
| --- a/cc/input/top_controls_manager.cc
|
| +++ b/cc/input/top_controls_manager.cc
|
| @@ -82,6 +82,16 @@ void TopControlsManager::UpdateTopControlsState(bool enable_hiding,
|
| }
|
| }
|
|
|
| +void TopControlsManager::ShowTopControls(bool show) {
|
| + if (show) {
|
| + DCHECK(visibility_restriction_ != ALWAYS_HIDDEN);
|
| + SetupAnimation(SHOWING_CONTROLS);
|
| + } else {
|
| + DCHECK(visibility_restriction_ != ALWAYS_SHOWN);
|
| + SetupAnimation(HIDING_CONTROLS);
|
| + }
|
| +}
|
| +
|
| void TopControlsManager::ScrollBegin() {
|
| ResetAnimations();
|
| current_scroll_delta_ = 0.f;
|
| @@ -153,6 +163,19 @@ void TopControlsManager::ResetAnimations() {
|
| }
|
|
|
| void TopControlsManager::SetupAnimation(AnimationDirection direction) {
|
| + DCHECK(direction != NO_ANIMATION);
|
| +
|
| + if (direction == SHOWING_CONTROLS && controls_top_offset_ == 0)
|
| + return;
|
| +
|
| + if (direction == HIDING_CONTROLS &&
|
| + controls_top_offset_ == -top_controls_height_) {
|
| + return;
|
| + }
|
| +
|
| + if (top_controls_animation_ && animation_direction_ == direction)
|
| + return;
|
| +
|
| top_controls_animation_ = KeyframedFloatAnimationCurve::Create();
|
| double start_time =
|
| (base::TimeTicks::Now() - base::TimeTicks()).InMillisecondsF();
|
| @@ -166,6 +189,7 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) {
|
| controls_top_offset_ + max_ending_offset,
|
| EaseTimingFunction::Create()));
|
| animation_direction_ = direction;
|
| + client_->DidChangeTopControlsPosition();
|
| }
|
|
|
| void TopControlsManager::StartAnimationIfNecessary() {
|
| @@ -187,11 +211,8 @@ void TopControlsManager::StartAnimationIfNecessary() {
|
| SHOWING_CONTROLS : HIDING_CONTROLS;
|
| }
|
|
|
| - if (show_controls != NO_ANIMATION &&
|
| - (!top_controls_animation_ || animation_direction_ != show_controls)) {
|
| + if (show_controls != NO_ANIMATION)
|
| SetupAnimation(show_controls);
|
| - client_->DidChangeTopControlsPosition();
|
| - }
|
| }
|
| }
|
|
|
|
|