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 "content/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "content/common/input/web_input_event_traits.h" | 10 #include "content/common/input/web_input_event_traits.h" |
11 #include "content/renderer/input/input_handler_proxy_client.h" | 11 #include "content/renderer/input/input_handler_proxy_client.h" |
12 #include "third_party/WebKit/public/platform/Platform.h" | 12 #include "third_party/WebKit/public/platform/Platform.h" |
13 #include "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
14 #include "ui/events/latency_info.h" | 14 #include "ui/events/latency_info.h" |
15 #include "ui/gfx/frame_time.h" | 15 #include "ui/gfx/frame_time.h" |
| 16 #include "ui/gfx/geometry/point_conversions.h" |
16 | 17 |
17 using blink::WebFloatPoint; | 18 using blink::WebFloatPoint; |
18 using blink::WebFloatSize; | 19 using blink::WebFloatSize; |
19 using blink::WebGestureEvent; | 20 using blink::WebGestureEvent; |
20 using blink::WebInputEvent; | 21 using blink::WebInputEvent; |
21 using blink::WebMouseEvent; | 22 using blink::WebMouseEvent; |
22 using blink::WebMouseWheelEvent; | 23 using blink::WebMouseWheelEvent; |
23 using blink::WebPoint; | 24 using blink::WebPoint; |
24 using blink::WebTouchEvent; | 25 using blink::WebTouchEvent; |
25 using blink::WebTouchPoint; | 26 using blink::WebTouchPoint; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 return DID_HANDLE; | 225 return DID_HANDLE; |
225 else if (!fling_may_be_active_on_main_thread_) | 226 else if (!fling_may_be_active_on_main_thread_) |
226 return DROP_EVENT; | 227 return DROP_EVENT; |
227 } else if (event.type == WebInputEvent::TouchStart) { | 228 } else if (event.type == WebInputEvent::TouchStart) { |
228 const WebTouchEvent& touch_event = | 229 const WebTouchEvent& touch_event = |
229 *static_cast<const WebTouchEvent*>(&event); | 230 *static_cast<const WebTouchEvent*>(&event); |
230 for (size_t i = 0; i < touch_event.touchesLength; ++i) { | 231 for (size_t i = 0; i < touch_event.touchesLength; ++i) { |
231 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) | 232 if (touch_event.touches[i].state != WebTouchPoint::StatePressed) |
232 continue; | 233 continue; |
233 if (input_handler_->HaveTouchEventHandlersAt( | 234 if (input_handler_->HaveTouchEventHandlersAt( |
234 blink::WebPoint(touch_event.touches[i].position.x, | 235 gfx::Point(touch_event.touches[i].position.x, |
235 touch_event.touches[i].position.y))) { | 236 touch_event.touches[i].position.y))) { |
236 return DID_NOT_HANDLE; | 237 return DID_NOT_HANDLE; |
237 } | 238 } |
238 } | 239 } |
239 return DROP_EVENT; | 240 return DROP_EVENT; |
240 } else if (WebInputEvent::isKeyboardEventType(event.type)) { | 241 } else if (WebInputEvent::isKeyboardEventType(event.type)) { |
241 CancelCurrentFling(true); | 242 CancelCurrentFling(true); |
242 } else if (event.type == WebInputEvent::MouseMove) { | 243 } else if (event.type == WebInputEvent::MouseMove) { |
243 const WebMouseEvent& mouse_event = | 244 const WebMouseEvent& mouse_event = |
244 *static_cast<const WebMouseEvent*>(&event); | 245 *static_cast<const WebMouseEvent*>(&event); |
245 // TODO(tony): Ignore when mouse buttons are down? | 246 // TODO(tony): Ignore when mouse buttons are down? |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 TRACE_EVENT2("input", | 490 TRACE_EVENT2("input", |
490 "InputHandlerProxy::notifyCurrentFlingVelocity", | 491 "InputHandlerProxy::notifyCurrentFlingVelocity", |
491 "vx", | 492 "vx", |
492 velocity.width, | 493 velocity.width, |
493 "vy", | 494 "vy", |
494 velocity.height); | 495 velocity.height); |
495 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); | 496 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); |
496 } | 497 } |
497 | 498 |
498 } // namespace content | 499 } // namespace content |
OLD | NEW |