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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 ResetAnimations(); | 122 ResetAnimations(); |
123 | 123 |
124 gfx::Vector2dF applied_delta(0.f, old_offset - controls_top_offset_); | 124 gfx::Vector2dF applied_delta(0.f, old_offset - controls_top_offset_); |
125 return pending_delta - applied_delta; | 125 return pending_delta - applied_delta; |
126 } | 126 } |
127 | 127 |
128 void TopControlsManager::ScrollEnd() { | 128 void TopControlsManager::ScrollEnd() { |
129 DCHECK(!pinch_gesture_active_); | 129 DCHECK(!pinch_gesture_active_); |
130 StartAnimationIfNecessary(); | 130 StartAnimationIfNecessary(); |
| 131 if (!top_controls_animation_) |
| 132 client_->DidFinishTopControlsGesture(); |
131 } | 133 } |
132 | 134 |
133 void TopControlsManager::PinchBegin() { | 135 void TopControlsManager::PinchBegin() { |
134 DCHECK(!pinch_gesture_active_); | 136 DCHECK(!pinch_gesture_active_); |
135 pinch_gesture_active_ = true; | 137 pinch_gesture_active_ = true; |
136 StartAnimationIfNecessary(); | 138 StartAnimationIfNecessary(); |
137 } | 139 } |
138 | 140 |
139 void TopControlsManager::PinchEnd() { | 141 void TopControlsManager::PinchEnd() { |
140 DCHECK(pinch_gesture_active_); | 142 DCHECK(pinch_gesture_active_); |
(...skipping 25 matching lines...) Expand all Loading... |
166 SetControlsTopOffset(top_controls_animation_->GetValue(time)); | 168 SetControlsTopOffset(top_controls_animation_->GetValue(time)); |
167 | 169 |
168 if (IsAnimationCompleteAtTime(monotonic_time)) | 170 if (IsAnimationCompleteAtTime(monotonic_time)) |
169 ResetAnimations(); | 171 ResetAnimations(); |
170 | 172 |
171 gfx::Vector2dF scroll_delta(0.f, controls_top_offset_ - old_offset); | 173 gfx::Vector2dF scroll_delta(0.f, controls_top_offset_ - old_offset); |
172 return scroll_delta; | 174 return scroll_delta; |
173 } | 175 } |
174 | 176 |
175 void TopControlsManager::ResetAnimations() { | 177 void TopControlsManager::ResetAnimations() { |
176 if (top_controls_animation_) | 178 if (top_controls_animation_) { |
177 top_controls_animation_.reset(); | 179 top_controls_animation_.reset(); |
| 180 client_->DidFinishTopControlsGesture(); |
| 181 } |
178 | 182 |
179 animation_direction_ = NO_ANIMATION; | 183 animation_direction_ = NO_ANIMATION; |
180 } | 184 } |
181 | 185 |
182 void TopControlsManager::SetupAnimation(AnimationDirection direction) { | 186 void TopControlsManager::SetupAnimation(AnimationDirection direction) { |
183 DCHECK(direction != NO_ANIMATION); | 187 DCHECK(direction != NO_ANIMATION); |
184 | 188 |
185 if (direction == SHOWING_CONTROLS && controls_top_offset_ == 0) | 189 if (direction == SHOWING_CONTROLS && controls_top_offset_ == 0) |
186 return; | 190 return; |
187 | 191 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 246 |
243 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || | 247 if ((animation_direction_ == SHOWING_CONTROLS && new_offset >= 0) || |
244 (animation_direction_ == HIDING_CONTROLS | 248 (animation_direction_ == HIDING_CONTROLS |
245 && new_offset <= -top_controls_height_)) { | 249 && new_offset <= -top_controls_height_)) { |
246 return true; | 250 return true; |
247 } | 251 } |
248 return false; | 252 return false; |
249 } | 253 } |
250 | 254 |
251 } // namespace cc | 255 } // namespace cc |
OLD | NEW |