| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "content/browser/renderer_host/event_with_latency_info.h" | 9 #include "content/browser/renderer_host/event_with_latency_info.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 | 11 |
| 12 namespace blink { | |
| 13 class WebGestureEvent; | |
| 14 class WebTouchEvent; | |
| 15 class WebTouchPoint; | |
| 16 } | |
| 17 | |
| 18 namespace ui { | 12 namespace ui { |
| 19 class GestureEvent; | |
| 20 class TouchEvent; | 13 class TouchEvent; |
| 21 } | 14 } |
| 22 | 15 |
| 23 namespace content { | 16 namespace content { |
| 24 | 17 |
| 25 enum TouchEventCoordinateSystem { | 18 enum TouchEventCoordinateSystem { |
| 26 SCREEN_COORDINATES, | 19 SCREEN_COORDINATES, |
| 27 LOCAL_COORDINATES | 20 LOCAL_COORDINATES |
| 28 }; | 21 }; |
| 29 | 22 |
| 30 // Creates a list of ui::TouchEvents out of a single WebTouchEvent. | 23 // Creates a list of ui::TouchEvents out of a single WebTouchEvent. |
| 31 // A WebTouchEvent can contain information about a number of WebTouchPoints, | 24 // A WebTouchEvent can contain information about a number of WebTouchPoints, |
| 32 // whereas a ui::TouchEvent contains information about a single touch-point. So | 25 // whereas a ui::TouchEvent contains information about a single touch-point. So |
| 33 // it is possible to create more than one ui::TouchEvents out of a single | 26 // it is possible to create more than one ui::TouchEvents out of a single |
| 34 // WebTouchEvent. All the ui::TouchEvent in the list will carry the same | 27 // WebTouchEvent. All the ui::TouchEvent in the list will carry the same |
| 35 // LatencyInfo the WebTouchEvent carries. | 28 // LatencyInfo the WebTouchEvent carries. |
| 36 // |coordinate_system| specifies which fields to use for the co-ordinates, | 29 // |coordinate_system| specifies which fields to use for the co-ordinates, |
| 37 // WebTouchPoint.position or WebTouchPoint.screenPosition. Is's up to the | 30 // WebTouchPoint.position or WebTouchPoint.screenPosition. Is's up to the |
| 38 // caller to do any co-ordinate system mapping (typically to get them into | 31 // caller to do any co-ordinate system mapping (typically to get them into |
| 39 // the Aura EventDispatcher co-ordinate system). | 32 // the Aura EventDispatcher co-ordinate system). |
| 40 CONTENT_EXPORT bool MakeUITouchEventsFromWebTouchEvents( | 33 CONTENT_EXPORT bool MakeUITouchEventsFromWebTouchEvents( |
| 41 const TouchEventWithLatencyInfo& touch, | 34 const TouchEventWithLatencyInfo& touch, |
| 42 ScopedVector<ui::TouchEvent>* list, | 35 ScopedVector<ui::TouchEvent>* list, |
| 43 TouchEventCoordinateSystem coordinate_system); | 36 TouchEventCoordinateSystem coordinate_system); |
| 44 | 37 |
| 45 // Creates a WebGestureEvent from a ui::GestureEvent. Note that it does not | |
| 46 // populate the event coordinates (i.e. |x|, |y|, |globalX|, and |globalY|). So | |
| 47 // the caller must populate these fields. | |
| 48 blink::WebGestureEvent MakeWebGestureEventFromUIEvent( | |
| 49 const ui::GestureEvent& event); | |
| 50 | |
| 51 } // namespace content | 38 } // namespace content |
| 52 | 39 |
| 53 #endif // CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ | 40 #endif // CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_ |
| OLD | NEW |