Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / ui_events_helper.h
blobfc57dd7a9e7df55842af515ba3e391a33fa95b1b
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_
8 #include "base/memory/scoped_vector.h"
9 #include "content/browser/renderer_host/event_with_latency_info.h"
10 #include "content/common/content_export.h"
12 namespace blink {
13 class WebGestureEvent;
14 class WebTouchEvent;
15 class WebTouchPoint;
18 namespace ui {
19 class GestureEvent;
20 class TouchEvent;
23 namespace content {
25 enum TouchEventCoordinateSystem {
26 SCREEN_COORDINATES,
27 LOCAL_COORDINATES
30 // Creates a list of ui::TouchEvents out of a single WebTouchEvent.
31 // A WebTouchEvent can contain information about a number of WebTouchPoints,
32 // 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
34 // WebTouchEvent. All the ui::TouchEvent in the list will carry the same
35 // LatencyInfo the WebTouchEvent carries.
36 // |coordinate_system| specifies which fields to use for the co-ordinates,
37 // WebTouchPoint.position or WebTouchPoint.screenPosition. Is's up to the
38 // caller to do any co-ordinate system mapping (typically to get them into
39 // the Aura EventDispatcher co-ordinate system).
40 CONTENT_EXPORT bool MakeUITouchEventsFromWebTouchEvents(
41 const TouchEventWithLatencyInfo& touch,
42 ScopedVector<ui::TouchEvent>* list,
43 TouchEventCoordinateSystem coordinate_system);
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);
51 } // namespace content
53 #endif // CONTENT_BROWSER_RENDERER_HOST_UI_EVENTS_HELPER_H_