| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/events/blink/web_input_event_traits.h" | 5 #include "ui/events/blink/web_input_event_traits.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| 10 #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" |
| 9 | 11 |
| 10 using base::StringAppendF; | 12 using base::StringAppendF; |
| 11 using base::SStringPrintf; | 13 using base::SStringPrintf; |
| 12 using blink::WebGestureEvent; | 14 using blink::WebGestureEvent; |
| 13 using blink::WebInputEvent; | 15 using blink::WebInputEvent; |
| 14 using blink::WebKeyboardEvent; | 16 using blink::WebKeyboardEvent; |
| 15 using blink::WebMouseEvent; | 17 using blink::WebMouseEvent; |
| 16 using blink::WebMouseWheelEvent; | 18 using blink::WebMouseWheelEvent; |
| 17 using blink::WebTouchEvent; | 19 using blink::WebTouchEvent; |
| 18 using blink::WebTouchPoint; | 20 using blink::WebTouchPoint; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 uint32_t WebInputEventTraits::GetUniqueTouchEventId( | 249 uint32_t WebInputEventTraits::GetUniqueTouchEventId( |
| 248 const WebInputEvent& event) { | 250 const WebInputEvent& event) { |
| 249 if (WebInputEvent::isTouchEventType(event.type)) { | 251 if (WebInputEvent::isTouchEventType(event.type)) { |
| 250 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; | 252 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; |
| 251 } | 253 } |
| 252 return 0U; | 254 return 0U; |
| 253 } | 255 } |
| 254 | 256 |
| 255 // static | 257 // static |
| 256 LatencyInfo WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( | 258 LatencyInfo WebInputEventTraits::CreateLatencyInfoForWebGestureEvent( |
| 257 WebGestureEvent event) { | 259 const WebGestureEvent& event) { |
| 258 SourceEventType source_event_type = SourceEventType::UNKNOWN; | 260 SourceEventType source_event_type = SourceEventType::UNKNOWN; |
| 259 if (event.sourceDevice == blink::WebGestureDevice::WebGestureDeviceTouchpad) { | 261 if (event.sourceDevice == blink::WebGestureDevice::WebGestureDeviceTouchpad) { |
| 260 source_event_type = SourceEventType::WHEEL; | 262 source_event_type = SourceEventType::WHEEL; |
| 261 } else if (event.sourceDevice == | 263 } else if (event.sourceDevice == |
| 262 blink::WebGestureDevice::WebGestureDeviceTouchscreen) { | 264 blink::WebGestureDevice::WebGestureDeviceTouchscreen) { |
| 263 source_event_type = SourceEventType::TOUCH; | 265 source_event_type = SourceEventType::TOUCH; |
| 264 } | 266 } |
| 265 LatencyInfo latency_info(source_event_type); | 267 LatencyInfo latency_info(source_event_type); |
| 266 return latency_info; | 268 return latency_info; |
| 267 } | 269 } |
| 268 | 270 |
| 269 } // namespace ui | 271 } // namespace ui |
| OLD | NEW |