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/browser/renderer_host/input/web_input_event_util.h" | 5 #include "content/browser/renderer_host/input/web_input_event_util.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 #include "ui/events/gesture_detection/gesture_event_data.h" | 9 #include "ui/events/gesture_detection/gesture_event_data.h" |
10 #include "ui/events/gesture_detection/motion_event.h" | 10 #include "ui/events/gesture_detection/motion_event.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 return result; | 233 return result; |
234 } | 234 } |
235 | 235 |
236 WebGestureEvent CreateWebGestureEventFromGestureEventData( | 236 WebGestureEvent CreateWebGestureEventFromGestureEventData( |
237 const ui::GestureEventData& data) { | 237 const ui::GestureEventData& data) { |
238 WebGestureEvent gesture; | 238 WebGestureEvent gesture; |
239 gesture.x = data.x; | 239 gesture.x = data.x; |
240 gesture.y = data.y; | 240 gesture.y = data.y; |
241 gesture.timeStampSeconds = (data.time - base::TimeTicks()).InSecondsF(); | 241 gesture.timeStampSeconds = (data.time - base::TimeTicks()).InSecondsF(); |
242 gesture.sourceDevice = WebGestureEvent::Touchscreen; | 242 gesture.sourceDevice = blink::WebGestureDeviceTouchpad; |
243 | 243 |
244 switch (data.type) { | 244 switch (data.type) { |
245 case ui::ET_GESTURE_SHOW_PRESS: | 245 case ui::ET_GESTURE_SHOW_PRESS: |
246 gesture.type = WebInputEvent::GestureShowPress; | 246 gesture.type = WebInputEvent::GestureShowPress; |
247 gesture.data.showPress.width = data.details.bounding_box_f().width(); | 247 gesture.data.showPress.width = data.details.bounding_box_f().width(); |
248 gesture.data.showPress.height = data.details.bounding_box_f().height(); | 248 gesture.data.showPress.height = data.details.bounding_box_f().height(); |
249 break; | 249 break; |
250 case ui::ET_GESTURE_DOUBLE_TAP: | 250 case ui::ET_GESTURE_DOUBLE_TAP: |
251 gesture.type = WebInputEvent::GestureDoubleTap; | 251 gesture.type = WebInputEvent::GestureDoubleTap; |
252 DCHECK_EQ(1, data.details.tap_count()); | 252 DCHECK_EQ(1, data.details.tap_count()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 break; | 324 break; |
325 default: | 325 default: |
326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; | 326 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; |
327 break; | 327 break; |
328 } | 328 } |
329 | 329 |
330 return gesture; | 330 return gesture; |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |