| Index: cc/input/top_controls_manager.cc
|
| diff --git a/cc/input/top_controls_manager.cc b/cc/input/top_controls_manager.cc
|
| index e1698f1316cbd626d7a500ca81ae2cd273b10131..f09644abc336b7dedab1c35dd9b6f704520c4ee1 100644
|
| --- a/cc/input/top_controls_manager.cc
|
| +++ b/cc/input/top_controls_manager.cc
|
| @@ -60,10 +60,16 @@ void TopControlsManager::EnableHidingTopControls(bool enable) {
|
|
|
| if (!enable) {
|
| ResetAnimations();
|
| - if (controls_top_offset_ != 0) {
|
| - SetupAnimation(SHOWING_CONTROLS);
|
| - client_->setNeedsRedraw();
|
| - }
|
| + SetupAnimation(SHOWING_CONTROLS);
|
| + }
|
| +}
|
| +
|
| +void TopControlsManager::ShowTopControls(bool show) {
|
| + if (show) {
|
| + SetupAnimation(SHOWING_CONTROLS);
|
| + } else {
|
| + DCHECK(enable_hiding_);
|
| + SetupAnimation(HIDING_CONTROLS);
|
| }
|
| }
|
|
|
| @@ -137,6 +143,18 @@ 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();
|
| @@ -150,6 +168,7 @@ void TopControlsManager::SetupAnimation(AnimationDirection direction) {
|
| controls_top_offset_ + max_ending_offset,
|
| EaseTimingFunction::Create()));
|
| animation_direction_ = direction;
|
| + client_->setNeedsRedraw();
|
| }
|
|
|
| void TopControlsManager::StartAnimationIfNecessary() {
|
| @@ -171,11 +190,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_->setNeedsRedraw();
|
| - }
|
| }
|
| }
|
|
|
|
|