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 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H
_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H
_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H
_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H
_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/native_web_keyboard_event.h" | 10 #include "content/public/browser/native_web_keyboard_event.h" |
11 #include "third_party/WebKit/public/web/WebInputEvent.h" | 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
12 | 12 |
13 // Provides sensible creation of default WebInputEvents for testing purposes. | 13 // Provides sensible creation of default WebInputEvents for testing purposes. |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class CONTENT_EXPORT SyntheticWebMouseEventBuilder { | 17 class CONTENT_EXPORT SyntheticWebMouseEventBuilder { |
18 public: | 18 public: |
19 static WebKit::WebMouseEvent Build(WebKit::WebInputEvent::Type type); | 19 static blink::WebMouseEvent Build(blink::WebInputEvent::Type type); |
20 static WebKit::WebMouseEvent Build(WebKit::WebInputEvent::Type type, | 20 static blink::WebMouseEvent Build(blink::WebInputEvent::Type type, |
21 int window_x, | 21 int window_x, |
22 int window_y, | 22 int window_y, |
23 int modifiers); | 23 int modifiers); |
24 }; | 24 }; |
25 | 25 |
26 class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder { | 26 class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder { |
27 public: | 27 public: |
28 static WebKit::WebMouseWheelEvent Build( | 28 static blink::WebMouseWheelEvent Build( |
29 WebKit::WebMouseWheelEvent::Phase phase); | 29 blink::WebMouseWheelEvent::Phase phase); |
30 static WebKit::WebMouseWheelEvent Build(float dx, | 30 static blink::WebMouseWheelEvent Build(float dx, |
31 float dy, | 31 float dy, |
32 int modifiers, | 32 int modifiers, |
33 bool precise); | 33 bool precise); |
34 }; | 34 }; |
35 | 35 |
36 class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder { | 36 class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder { |
37 public: | 37 public: |
38 static NativeWebKeyboardEvent Build(WebKit::WebInputEvent::Type type); | 38 static NativeWebKeyboardEvent Build(blink::WebInputEvent::Type type); |
39 }; | 39 }; |
40 | 40 |
41 class CONTENT_EXPORT SyntheticWebGestureEventBuilder { | 41 class CONTENT_EXPORT SyntheticWebGestureEventBuilder { |
42 public: | 42 public: |
43 static WebKit::WebGestureEvent Build( | 43 static blink::WebGestureEvent Build( |
44 WebKit::WebInputEvent::Type type, | 44 blink::WebInputEvent::Type type, |
45 WebKit::WebGestureEvent::SourceDevice sourceDevice); | 45 blink::WebGestureEvent::SourceDevice sourceDevice); |
46 static WebKit::WebGestureEvent BuildScrollUpdate(float dx, | 46 static blink::WebGestureEvent BuildScrollUpdate(float dx, |
47 float dY, | 47 float dY, |
48 int modifiers); | 48 int modifiers); |
49 static WebKit::WebGestureEvent BuildPinchUpdate(float scale, | 49 static blink::WebGestureEvent BuildPinchUpdate(float scale, |
50 float anchor_x, | 50 float anchor_x, |
51 float anchor_y, | 51 float anchor_y, |
52 int modifiers); | 52 int modifiers); |
53 static WebKit::WebGestureEvent BuildFling( | 53 static blink::WebGestureEvent BuildFling( |
54 float velocity_x, | 54 float velocity_x, |
55 float velocity_y, | 55 float velocity_y, |
56 WebKit::WebGestureEvent::SourceDevice source_device); | 56 blink::WebGestureEvent::SourceDevice source_device); |
57 }; | 57 }; |
58 | 58 |
59 class CONTENT_EXPORT SyntheticWebTouchEvent | 59 class CONTENT_EXPORT SyntheticWebTouchEvent |
60 : public NON_EXPORTED_BASE(WebKit::WebTouchEvent) { | 60 : public NON_EXPORTED_BASE(blink::WebTouchEvent) { |
61 public: | 61 public: |
62 SyntheticWebTouchEvent(); | 62 SyntheticWebTouchEvent(); |
63 | 63 |
64 // Mark all the points as stationary, and remove any released points. | 64 // Mark all the points as stationary, and remove any released points. |
65 void ResetPoints(); | 65 void ResetPoints(); |
66 | 66 |
67 // Adds an additional point to the touch list, returning the point's index. | 67 // Adds an additional point to the touch list, returning the point's index. |
68 int PressPoint(int x, int y); | 68 int PressPoint(int x, int y); |
69 void MovePoint(int index, int x, int y); | 69 void MovePoint(int index, int x, int y); |
70 void ReleasePoint(int index); | 70 void ReleasePoint(int index); |
71 | 71 |
72 void SetTimestamp(base::TimeDelta timestamp); | 72 void SetTimestamp(base::TimeDelta timestamp); |
73 }; | 73 }; |
74 | 74 |
75 class CONTENT_EXPORT SyntheticWebTouchEventBuilder { | 75 class CONTENT_EXPORT SyntheticWebTouchEventBuilder { |
76 public: | 76 public: |
77 static SyntheticWebTouchEvent Build(WebKit::WebInputEvent::Type type); | 77 static SyntheticWebTouchEvent Build(blink::WebInputEvent::Type type); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace content | 80 } // namespace content |
81 | 81 |
82 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDER
S_H_ | 82 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDER
S_H_ |
OLD | NEW |