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/gesture_event_filter.h" | 7 #include "content/browser/renderer_host/gesture_event_filter.h" |
8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 8 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
9 #include "content/browser/renderer_host/render_widget_host_impl.h" | 9 #include "content/browser/renderer_host/render_widget_host_impl.h" |
10 #include "content/public/browser/overscroll_configuration.h" | 10 #include "content/public/browser/overscroll_configuration.h" |
11 #include "content/public/browser/render_widget_host_view.h" | 11 #include "content/public/browser/render_widget_host_view.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 OverscrollController::OverscrollController( | 15 OverscrollController::OverscrollController( |
16 RenderWidgetHostImpl* render_widget_host) | 16 RenderWidgetHostImpl* render_widget_host) |
17 : render_widget_host_(render_widget_host), | 17 : render_widget_host_(render_widget_host), |
18 overscroll_mode_(OVERSCROLL_NONE), | 18 overscroll_mode_(OVERSCROLL_NONE), |
19 overscroll_delta_x_(0.f), | 19 overscroll_delta_x_(0.f), |
20 overscroll_delta_y_(0.f), | 20 overscroll_delta_y_(0.f), |
21 delegate_(NULL) { | 21 delegate_(NULL) { |
22 } | 22 } |
23 | 23 |
24 OverscrollController::~OverscrollController() { | 24 OverscrollController::~OverscrollController() { |
25 } | 25 } |
26 | 26 |
27 bool OverscrollController::WillDispatchEvent( | 27 bool OverscrollController::WillDispatchEvent( |
28 const WebKit::WebInputEvent& event, | 28 const WebKit::WebInputEvent& event, |
29 const cc::LatencyInfo& latency_info) { | 29 const ui::LatencyInfo& latency_info) { |
30 if (DispatchEventCompletesAction(event)) { | 30 if (DispatchEventCompletesAction(event)) { |
31 CompleteAction(); | 31 CompleteAction(); |
32 | 32 |
33 // If the overscroll was caused by touch-scrolling, then the gesture event | 33 // If the overscroll was caused by touch-scrolling, then the gesture event |
34 // that completes the action needs to be sent to the renderer, because the | 34 // that completes the action needs to be sent to the renderer, because the |
35 // touch-scrolls maintain state in the renderer side (in the compositor, for | 35 // touch-scrolls maintain state in the renderer side (in the compositor, for |
36 // example), and the event that completes this action needs to be sent to | 36 // example), and the event that completes this action needs to be sent to |
37 // the renderer so that those states can be updated/reset appropriately. | 37 // the renderer so that those states can be updated/reset appropriately. |
38 // Send the event through the gesture-event filter when appropriate. | 38 // Send the event through the gesture-event filter when appropriate. |
39 if (ShouldForwardToGestureFilter(event)) { | 39 if (ShouldForwardToGestureFilter(event)) { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 const WebKit::WebInputEvent& event) const { | 300 const WebKit::WebInputEvent& event) const { |
301 if (!WebKit::WebInputEvent::isGestureEventType(event.type)) | 301 if (!WebKit::WebInputEvent::isGestureEventType(event.type)) |
302 return false; | 302 return false; |
303 | 303 |
304 // If the GestureEventFilter already processed this event, then the event must | 304 // If the GestureEventFilter already processed this event, then the event must |
305 // not be sent to the filter again. | 305 // not be sent to the filter again. |
306 return !render_widget_host_->gesture_event_filter()->HasQueuedGestureEvents(); | 306 return !render_widget_host_->gesture_event_filter()->HasQueuedGestureEvents(); |
307 } | 307 } |
308 | 308 |
309 } // namespace content | 309 } // namespace content |
OLD | NEW |