OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/synthetic_touch_driver.h" | 5 #include "content/browser/renderer_host/input/synthetic_touch_driver.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
8 | 8 |
9 using blink::WebTouchEvent; | 9 using blink::WebTouchEvent; |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 SyntheticTouchDriver::SyntheticTouchDriver() {} | 13 SyntheticTouchDriver::SyntheticTouchDriver() {} |
14 | 14 |
15 SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event) | 15 SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event) |
16 : touch_event_(touch_event) {} | 16 : touch_event_(touch_event) {} |
17 | 17 |
18 SyntheticTouchDriver::~SyntheticTouchDriver() {} | 18 SyntheticTouchDriver::~SyntheticTouchDriver() {} |
19 | 19 |
20 void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target, | 20 void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target, |
21 const base::TimeTicks& timestamp) { | 21 const base::TimeTicks& timestamp) { |
22 touch_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp); | 22 touch_event_.setTimeStampSeconds(ConvertTimestampToSeconds(timestamp)); |
23 target->DispatchInputEventToPlatform(touch_event_); | 23 target->DispatchInputEventToPlatform(touch_event_); |
24 } | 24 } |
25 | 25 |
26 int SyntheticTouchDriver::Press(float x, float y) { | 26 int SyntheticTouchDriver::Press(float x, float y) { |
27 int index = touch_event_.PressPoint(x, y); | 27 int index = touch_event_.PressPoint(x, y); |
28 return index; | 28 return index; |
29 } | 29 } |
30 | 30 |
31 void SyntheticTouchDriver::Move(float x, float y, int index) { | 31 void SyntheticTouchDriver::Move(float x, float y, int index) { |
32 touch_event_.MovePoint(index, x, y); | 32 touch_event_.MovePoint(index, x, y); |
(...skipping 30 matching lines...) Expand all Loading... |
63 if (params.pointer_action_type() == | 63 if (params.pointer_action_type() == |
64 SyntheticPointerActionParams::PointerActionType::RELEASE && | 64 SyntheticPointerActionParams::PointerActionType::RELEASE && |
65 params.index() == -1) { | 65 params.index() == -1) { |
66 return false; | 66 return false; |
67 } | 67 } |
68 | 68 |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 } // namespace content | 72 } // namespace content |
OLD | NEW |