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 top_controls_animation_ = nullptr; | 183 if (top_controls_animation_) |
| 184 top_controls_animation_.reset(); |
| 185 |
184 animation_direction_ = NO_ANIMATION; | 186 animation_direction_ = NO_ANIMATION; |
185 } | 187 } |
186 | 188 |
187 void TopControlsManager::SetupAnimation(AnimationDirection direction) { | 189 void TopControlsManager::SetupAnimation(AnimationDirection direction) { |
188 DCHECK(direction != NO_ANIMATION); | 190 DCHECK(direction != NO_ANIMATION); |
189 | 191 |
190 if (direction == SHOWING_CONTROLS && client_->ControlsTopOffset() == 0) | 192 if (direction == SHOWING_CONTROLS && client_->ControlsTopOffset() == 0) |
191 return; | 193 return; |
192 | 194 |
193 if (direction == HIDING_CONTROLS && | 195 if (direction == HIDING_CONTROLS && |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 249 |
248 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 250 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
249 (animation_direction_ == HIDING_CONTROLS | 251 (animation_direction_ == HIDING_CONTROLS |
250 && new_offset <= -top_controls_height_)) { | 252 && new_offset <= -top_controls_height_)) { |
251 return true; | 253 return true; |
252 } | 254 } |
253 return false; | 255 return false; |
254 } | 256 } |
255 | 257 |
256 } // namespace cc | 258 } // namespace cc |
OLD | NEW |