| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 return; | 195 return; |
| 196 } | 196 } |
| 197 | 197 |
| 198 if (top_controls_animation_ && animation_direction_ == direction) | 198 if (top_controls_animation_ && animation_direction_ == direction) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 top_controls_animation_ = KeyframedFloatAnimationCurve::Create(); | 201 top_controls_animation_ = KeyframedFloatAnimationCurve::Create(); |
| 202 double start_time = | 202 double start_time = |
| 203 (gfx::FrameTime::Now() - base::TimeTicks()).InMillisecondsF(); | 203 (gfx::FrameTime::Now() - base::TimeTicks()).InMillisecondsF(); |
| 204 top_controls_animation_->AddKeyframe( | 204 top_controls_animation_->AddKeyframe( |
| 205 FloatKeyframe::Create(start_time, client_->ControlsTopOffset(), | 205 FloatKeyframe::Create(start_time, client_->ControlsTopOffset(), nullptr)); |
| 206 scoped_ptr<TimingFunction>())); | |
| 207 float max_ending_offset = | 206 float max_ending_offset = |
| 208 (direction == SHOWING_CONTROLS ? 1 : -1) * top_controls_height_; | 207 (direction == SHOWING_CONTROLS ? 1 : -1) * top_controls_height_; |
| 209 top_controls_animation_->AddKeyframe( | 208 top_controls_animation_->AddKeyframe( |
| 210 FloatKeyframe::Create(start_time + kShowHideMaxDurationMs, | 209 FloatKeyframe::Create(start_time + kShowHideMaxDurationMs, |
| 211 client_->ControlsTopOffset() + max_ending_offset, | 210 client_->ControlsTopOffset() + max_ending_offset, |
| 212 EaseTimingFunction::Create())); | 211 EaseTimingFunction::Create())); |
| 213 animation_direction_ = direction; | 212 animation_direction_ = direction; |
| 214 client_->DidChangeTopControlsPosition(); | 213 client_->DidChangeTopControlsPosition(); |
| 215 } | 214 } |
| 216 | 215 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 247 | 246 |
| 248 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 247 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
| 249 (animation_direction_ == HIDING_CONTROLS | 248 (animation_direction_ == HIDING_CONTROLS |
| 250 && new_offset <= -top_controls_height_)) { | 249 && new_offset <= -top_controls_height_)) { |
| 251 return true; | 250 return true; |
| 252 } | 251 } |
| 253 return false; | 252 return false; |
| 254 } | 253 } |
| 255 | 254 |
| 256 } // namespace cc | 255 } // namespace cc |
| OLD | NEW |