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/common/input/synthetic_web_input_event_builders.h" | 5 #include "content/common/input/synthetic_web_input_event_builders.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.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/base_event_utils.h" |
9 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 using blink::WebInputEvent; | 14 using blink::WebInputEvent; |
14 using blink::WebKeyboardEvent; | 15 using blink::WebKeyboardEvent; |
15 using blink::WebGestureEvent; | 16 using blink::WebGestureEvent; |
16 using blink::WebMouseEvent; | 17 using blink::WebMouseEvent; |
17 using blink::WebMouseWheelEvent; | 18 using blink::WebMouseWheelEvent; |
18 using blink::WebTouchEvent; | 19 using blink::WebTouchEvent; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 float velocity_y, | 144 float velocity_y, |
144 blink::WebGestureDevice source_device) { | 145 blink::WebGestureDevice source_device) { |
145 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, | 146 WebGestureEvent result = Build(WebInputEvent::GestureFlingStart, |
146 source_device); | 147 source_device); |
147 result.data.flingStart.velocityX = velocity_x; | 148 result.data.flingStart.velocityX = velocity_x; |
148 result.data.flingStart.velocityY = velocity_y; | 149 result.data.flingStart.velocityY = velocity_y; |
149 return result; | 150 return result; |
150 } | 151 } |
151 | 152 |
152 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { | 153 SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() { |
| 154 uniqueTouchEventId = ui::GetNextTouchEventId(); |
153 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); | 155 SetTimestamp(base::TimeTicks::Now() - base::TimeTicks()); |
154 } | 156 } |
155 | 157 |
156 void SyntheticWebTouchEvent::ResetPoints() { | 158 void SyntheticWebTouchEvent::ResetPoints() { |
157 int point = 0; | 159 int point = 0; |
158 for (unsigned int i = 0; i < touchesLength; ++i) { | 160 for (unsigned int i = 0; i < touchesLength; ++i) { |
159 if (touches[i].state == WebTouchPoint::StateReleased) | 161 if (touches[i].state == WebTouchPoint::StateReleased) |
160 continue; | 162 continue; |
161 | 163 |
162 touches[point] = touches[i]; | 164 touches[point] = touches[i]; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 touches[index].state = WebTouchPoint::StateCancelled; | 215 touches[index].state = WebTouchPoint::StateCancelled; |
214 WebTouchEventTraits::ResetType( | 216 WebTouchEventTraits::ResetType( |
215 WebInputEvent::TouchCancel, timeStampSeconds, this); | 217 WebInputEvent::TouchCancel, timeStampSeconds, this); |
216 } | 218 } |
217 | 219 |
218 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { | 220 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { |
219 timeStampSeconds = timestamp.InSecondsF(); | 221 timeStampSeconds = timestamp.InSecondsF(); |
220 } | 222 } |
221 | 223 |
222 } // namespace content | 224 } // namespace content |
OLD | NEW |