| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/input/top_controls_manager.h" | 5 #include "cc/input/top_controls_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "cc/animation/keyframed_animation_curve.h" | 10 #include "cc/animation/keyframed_animation_curve.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 SetControlsTopOffset(top_controls_animation_->GetValue(time)); | 173 SetControlsTopOffset(top_controls_animation_->GetValue(time)); |
| 174 | 174 |
| 175 if (IsAnimationCompleteAtTime(monotonic_time)) | 175 if (IsAnimationCompleteAtTime(monotonic_time)) |
| 176 ResetAnimations(); | 176 ResetAnimations(); |
| 177 | 177 |
| 178 gfx::Vector2dF scroll_delta(0.f, client_->ControlsTopOffset() - old_offset); | 178 gfx::Vector2dF scroll_delta(0.f, client_->ControlsTopOffset() - old_offset); |
| 179 return scroll_delta; | 179 return scroll_delta; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TopControlsManager::ResetAnimations() { | 182 void TopControlsManager::ResetAnimations() { |
| 183 if (top_controls_animation_) | 183 top_controls_animation_ = nullptr; |
| 184 top_controls_animation_.reset(); | |
| 185 | |
| 186 animation_direction_ = NO_ANIMATION; | 184 animation_direction_ = NO_ANIMATION; |
| 187 } | 185 } |
| 188 | 186 |
| 189 void TopControlsManager::SetupAnimation(AnimationDirection direction) { | 187 void TopControlsManager::SetupAnimation(AnimationDirection direction) { |
| 190 DCHECK(direction != NO_ANIMATION); | 188 DCHECK(direction != NO_ANIMATION); |
| 191 | 189 |
| 192 if (direction == SHOWING_CONTROLS && client_->ControlsTopOffset() == 0) | 190 if (direction == SHOWING_CONTROLS && client_->ControlsTopOffset() == 0) |
| 193 return; | 191 return; |
| 194 | 192 |
| 195 if (direction == HIDING_CONTROLS && | 193 if (direction == HIDING_CONTROLS && |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 247 |
| 250 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 248 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
| 251 (animation_direction_ == HIDING_CONTROLS | 249 (animation_direction_ == HIDING_CONTROLS |
| 252 && new_offset <= -top_controls_height_)) { | 250 && new_offset <= -top_controls_height_)) { |
| 253 return true; | 251 return true; |
| 254 } | 252 } |
| 255 return false; | 253 return false; |
| 256 } | 254 } |
| 257 | 255 |
| 258 } // namespace cc | 256 } // namespace cc |
| OLD | NEW |