| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/android/overscroll_controller_android.h" | 5 #include "content/browser/android/overscroll_controller_android.h" |
| 6 | 6 |
| 7 #include "base/android/build_info.h" | 7 #include "base/android/build_info.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/output/compositor_frame_metadata.h" | 10 #include "cc/output/compositor_frame_metadata.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // The overscroll effect requires an explicit release signal that may not be | 120 // The overscroll effect requires an explicit release signal that may not be |
| 121 // sent from the renderer compositor. | 121 // sent from the renderer compositor. |
| 122 if (event.type == blink::WebInputEvent::GestureScrollEnd || | 122 if (event.type == blink::WebInputEvent::GestureScrollEnd || |
| 123 event.type == blink::WebInputEvent::GestureFlingStart) { | 123 event.type == blink::WebInputEvent::GestureFlingStart) { |
| 124 OnOverscrolled(DidOverscrollParams()); | 124 OnOverscrolled(DidOverscrollParams()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { | 127 if (event.type == blink::WebInputEvent::GestureScrollUpdate) { |
| 128 // The effect should only be allowed if both the causal touch events go | 128 // The effect should only be allowed if both the causal touch events go |
| 129 // unconsumed and the generated scroll events go unconsumed. | 129 // unconsumed and the generated scroll events go unconsumed. |
| 130 // TODO(jdduke): Prevent activation if the first touchmove was consumed, | 130 bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED || |
| 131 // i.e., the first GSU was prevented. | 131 event.data.scrollUpdate.previousUpdateInSequencePrevented; |
| 132 bool consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | |
| 133 refresh_effect_.OnScrollUpdateAck(consumed); | 132 refresh_effect_.OnScrollUpdateAck(consumed); |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 | 135 |
| 137 void OverscrollControllerAndroid::OnOverscrolled( | 136 void OverscrollControllerAndroid::OnOverscrolled( |
| 138 const DidOverscrollParams& params) { | 137 const DidOverscrollParams& params) { |
| 139 if (!enabled_) | 138 if (!enabled_) |
| 140 return; | 139 return; |
| 141 | 140 |
| 142 if (refresh_effect_.IsActive() || | 141 if (refresh_effect_.IsActive() || |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 217 |
| 219 bool OverscrollControllerAndroid::IsStillRefreshing() const { | 218 bool OverscrollControllerAndroid::IsStillRefreshing() const { |
| 220 return triggered_refresh_active_; | 219 return triggered_refresh_active_; |
| 221 } | 220 } |
| 222 | 221 |
| 223 void OverscrollControllerAndroid::SetNeedsAnimate() { | 222 void OverscrollControllerAndroid::SetNeedsAnimate() { |
| 224 compositor_->SetNeedsAnimate(); | 223 compositor_->SetNeedsAnimate(); |
| 225 } | 224 } |
| 226 | 225 |
| 227 } // namespace content | 226 } // namespace content |
| OLD | NEW |