OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_TOUCH_EMULATOR_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ |
7 | 7 |
8 #include "content/browser/renderer_host/input/touch_emulator_client.h" | 8 #include "content/browser/renderer_host/input/touch_emulator_client.h" |
9 #include "content/common/cursors/webcursor.h" | 9 #include "content/common/cursors/webcursor.h" |
10 #include "content/common/input/input_event_ack_state.h" | 10 #include "content/common/input/input_event_ack_state.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Returns cursor size in DIP. | 50 // Returns cursor size in DIP. |
51 gfx::SizeF InitCursorFromResource( | 51 gfx::SizeF InitCursorFromResource( |
52 WebCursor* cursor, float scale, int resource_id); | 52 WebCursor* cursor, float scale, int resource_id); |
53 void ResetState(); | 53 void ResetState(); |
54 void UpdateCursor(); | 54 void UpdateCursor(); |
55 bool UpdateShiftPressed(bool shift_pressed); | 55 bool UpdateShiftPressed(bool shift_pressed); |
56 | 56 |
57 // Whether we should convert scrolls into pinches. | 57 // Whether we should convert scrolls into pinches. |
58 bool InPinchGestureMode() const; | 58 bool InPinchGestureMode() const; |
59 | 59 |
60 bool FillTouchEventAndPoint(const blink::WebMouseEvent& mouse_event); | 60 void FillTouchEventAndPoint(const blink::WebMouseEvent& mouse_event); |
61 void FillPinchEvent(const blink::WebInputEvent& event); | 61 void FillPinchEvent(const blink::WebInputEvent& event); |
62 | 62 |
63 // The following methods generate and pass gesture events to the renderer. | 63 // The following methods generate and pass gesture events to the renderer. |
64 void PinchBegin(const blink::WebGestureEvent& event); | 64 void PinchBegin(const blink::WebGestureEvent& event); |
65 void PinchUpdate(const blink::WebGestureEvent& event); | 65 void PinchUpdate(const blink::WebGestureEvent& event); |
66 void PinchEnd(const blink::WebGestureEvent& event); | 66 void PinchEnd(const blink::WebGestureEvent& event); |
67 void ScrollEnd(const blink::WebGestureEvent& event); | 67 void ScrollEnd(const blink::WebGestureEvent& event); |
68 | 68 |
69 void ForwardTouchEventToClient(); | 69 // Offers the emulated event to |gesture_provider_|, conditionally forwarding |
| 70 // it to the client if appropriate. |
| 71 void HandleEmulatedTouchEvent(blink::WebTouchEvent event); |
70 | 72 |
71 TouchEmulatorClient* const client_; | 73 TouchEmulatorClient* const client_; |
72 ui::FilteredGestureProvider gesture_provider_; | 74 ui::FilteredGestureProvider gesture_provider_; |
73 | 75 |
74 // Disabled emulator does only process touch acks left from previous | 76 // Disabled emulator does only process touch acks left from previous |
75 // emulation. It does not intercept any events. | 77 // emulation. It does not intercept any events. |
76 bool enabled_; | 78 bool enabled_; |
77 | 79 |
78 // While emulation is on, default cursor is touch. Pressing shift changes | 80 // While emulation is on, default cursor is touch. Pressing shift changes |
79 // cursor to the pinch one. | 81 // cursor to the pinch one. |
(...skipping 24 matching lines...) Expand all Loading... |
104 // The cumulative scale change from the start of pinch gesture. | 106 // The cumulative scale change from the start of pinch gesture. |
105 float pinch_scale_; | 107 float pinch_scale_; |
106 bool pinch_gesture_active_; | 108 bool pinch_gesture_active_; |
107 | 109 |
108 DISALLOW_COPY_AND_ASSIGN(TouchEmulator); | 110 DISALLOW_COPY_AND_ASSIGN(TouchEmulator); |
109 }; | 111 }; |
110 | 112 |
111 } // namespace content | 113 } // namespace content |
112 | 114 |
113 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ | 115 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ |
OLD | NEW |