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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 } else { | 208 } else { |
209 base::snprintf(event->keyIdentifier, | 209 base::snprintf(event->keyIdentifier, |
210 sizeof(event->keyIdentifier), | 210 sizeof(event->keyIdentifier), |
211 "U+%04X", | 211 "U+%04X", |
212 base::ToUpperASCII(static_cast<int>(windows_key_code))); | 212 base::ToUpperASCII(static_cast<int>(windows_key_code))); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( | 216 blink::WebTouchEvent CreateWebTouchEventFromMotionEvent( |
217 const ui::MotionEvent& event) { | 217 const ui::MotionEvent& event) { |
| 218 COMPILE_ASSERT(static_cast<int>(MotionEvent::MAX_TOUCH_POINT_COUNT) == |
| 219 static_cast<int>(blink::WebTouchEvent::touchesLengthCap), |
| 220 inconsistent_maximum_number_of_active_touch_points); |
| 221 |
218 blink::WebTouchEvent result; | 222 blink::WebTouchEvent result; |
219 | 223 |
220 WebTouchEventTraits::ResetType( | 224 WebTouchEventTraits::ResetType( |
221 ToWebInputEventType(event.GetAction()), | 225 ToWebInputEventType(event.GetAction()), |
222 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), | 226 (event.GetEventTime() - base::TimeTicks()).InSecondsF(), |
223 &result); | 227 &result); |
224 | 228 |
225 result.touchesLength = | 229 result.touchesLength = |
226 std::min(event.GetPointerCount(), | 230 std::min(event.GetPointerCount(), |
227 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); | 231 static_cast<size_t>(WebTouchEvent::touchesLengthCap)); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 break; | 330 break; |
327 default: | 331 default: |
328 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; | 332 NOTREACHED() << "ui::EventType provided wasn't a valid gesture event."; |
329 break; | 333 break; |
330 } | 334 } |
331 | 335 |
332 return gesture; | 336 return gesture; |
333 } | 337 } |
334 | 338 |
335 } // namespace content | 339 } // namespace content |
OLD | NEW |