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" |
11 #include "third_party/WebKit/public/web/WebInputEvent.h" | 11 #include "third_party/WebKit/public/web/WebInputEvent.h" |
12 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | 12 #include "ui/events/gesture_detection/filtered_gesture_provider.h" |
| 13 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
13 #include "ui/gfx/size_f.h" | 14 #include "ui/gfx/size_f.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 // Emulates touch input with mouse and keyboard. | 18 // Emulates touch input with mouse and keyboard. |
18 class CONTENT_EXPORT TouchEmulator : public ui::GestureProviderClient { | 19 class CONTENT_EXPORT TouchEmulator : public ui::GestureProviderClient { |
19 public: | 20 public: |
20 explicit TouchEmulator(TouchEmulatorClient* client); | 21 explicit TouchEmulator(TouchEmulatorClient* client); |
21 ~TouchEmulator() override; | 22 ~TouchEmulator() override; |
22 | 23 |
23 void Enable(); | 24 void Enable(ui::GestureProviderConfigType config_type); |
24 void Disable(); | 25 void Disable(); |
25 | 26 |
26 // Note that TouchEmulator should always listen to touch events and their acks | 27 // Note that TouchEmulator should always listen to touch events and their acks |
27 // (even in disabled state) to track native stream presence. | 28 // (even in disabled state) to track native stream presence. |
28 bool enabled() const { return !!gesture_provider_.get(); } | 29 bool enabled() const { return !!gesture_provider_.get(); } |
29 | 30 |
30 // Returns |true| if the event was consumed. Consumed event should not | 31 // Returns |true| if the event was consumed. Consumed event should not |
31 // propagate any further. | 32 // propagate any further. |
32 // TODO(dgozman): maybe pass latency info together with events. | 33 // TODO(dgozman): maybe pass latency info together with events. |
33 bool HandleMouseEvent(const blink::WebMouseEvent& event); | 34 bool HandleMouseEvent(const blink::WebMouseEvent& event); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // The cumulative scale change from the start of pinch gesture. | 107 // The cumulative scale change from the start of pinch gesture. |
107 float pinch_scale_; | 108 float pinch_scale_; |
108 bool pinch_gesture_active_; | 109 bool pinch_gesture_active_; |
109 | 110 |
110 DISALLOW_COPY_AND_ASSIGN(TouchEmulator); | 111 DISALLOW_COPY_AND_ASSIGN(TouchEmulator); |
111 }; | 112 }; |
112 | 113 |
113 } // namespace content | 114 } // namespace content |
114 | 115 |
115 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ | 116 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_TOUCH_EMULATOR_H_ |
OLD | NEW |