OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/overscroll_controller.h" | 5 #include "content/browser/renderer_host/overscroll_controller.h" |
6 | 6 |
| 7 #include "content/browser/renderer_host/input/gesture_event_filter.h" |
7 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "content/public/browser/overscroll_configuration.h" | 10 #include "content/public/browser/overscroll_configuration.h" |
10 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
11 | 12 |
12 using WebKit::WebInputEvent; | 13 using WebKit::WebInputEvent; |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 OverscrollController::OverscrollController( | 17 OverscrollController::OverscrollController( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Consume the event only if it updates the overscroll state. | 98 // Consume the event only if it updates the overscroll state. |
98 if (ProcessEventForOverscroll(event)) | 99 if (ProcessEventForOverscroll(event)) |
99 return false; | 100 return false; |
100 } | 101 } |
101 | 102 |
102 return true; | 103 return true; |
103 } | 104 } |
104 | 105 |
105 void OverscrollController::ReceivedEventACK(const WebKit::WebInputEvent& event, | 106 void OverscrollController::ReceivedEventACK(const WebKit::WebInputEvent& event, |
106 bool processed) { | 107 bool processed) { |
| 108 DCHECK(!GestureEventFilter::IsGestureEventTypeAsync(event.type)); |
107 if (processed) { | 109 if (processed) { |
108 // If a scroll event is consumed by the page, i.e. some content on the page | 110 // If a scroll event is consumed by the page, i.e. some content on the page |
109 // has been scrolled, then there is not going to be an overscroll gesture, | 111 // has been scrolled, then there is not going to be an overscroll gesture, |
110 // until the current scroll ends, and a new scroll gesture starts. | 112 // until the current scroll ends, and a new scroll gesture starts. |
111 if (scroll_state_ == STATE_UNKNOWN && | 113 if (scroll_state_ == STATE_UNKNOWN && |
112 (event.type == WebKit::WebInputEvent::MouseWheel || | 114 (event.type == WebKit::WebInputEvent::MouseWheel || |
113 event.type == WebKit::WebInputEvent::GestureScrollUpdate)) { | 115 event.type == WebKit::WebInputEvent::GestureScrollUpdate)) { |
114 scroll_state_ = STATE_CONTENT_SCROLLING; | 116 scroll_state_ = STATE_CONTENT_SCROLLING; |
115 } | 117 } |
116 return; | 118 return; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 overscroll_mode_ = mode; | 364 overscroll_mode_ = mode; |
363 if (overscroll_mode_ == OVERSCROLL_NONE) | 365 if (overscroll_mode_ == OVERSCROLL_NONE) |
364 overscroll_delta_x_ = overscroll_delta_y_ = 0.f; | 366 overscroll_delta_x_ = overscroll_delta_y_ = 0.f; |
365 else | 367 else |
366 scroll_state_ = STATE_OVERSCROLLING; | 368 scroll_state_ = STATE_OVERSCROLLING; |
367 if (delegate_) | 369 if (delegate_) |
368 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); | 370 delegate_->OnOverscrollModeChange(old_mode, overscroll_mode_); |
369 } | 371 } |
370 | 372 |
371 } // namespace content | 373 } // namespace content |
OLD | NEW |