OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
tdresser
2014/02/27 15:28:30
2014
jdduke (slow)
2014/02/27 17:40:29
Done.
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_ | |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "content/browser/renderer_host/input/gesture_event_packet.h" | |
10 #include "content/browser/renderer_host/input/touch_disposition_gesture_filter.h " | |
tdresser
2014/02/27 15:28:30
Wrapping after the #include would probably be nice
jdduke (slow)
2014/02/27 17:40:29
Hmm, I haven't noticed line breaking on long heade
| |
11 #include "ui/events/gesture_detection/gesture_provider.h" | |
12 | |
13 namespace content { | |
14 | |
15 class ContentGestureProviderClient { | |
16 public: | |
17 virtual ~ContentGestureProviderClient() {} | |
18 virtual void OnGestureEvent(const blink::WebGestureEvent& event) = 0; | |
tdresser
2014/02/27 15:28:30
Couldn't this object be entirely platform independ
jdduke (slow)
2014/02/27 17:40:29
I'm not sure I understand what you're saying. The
| |
19 }; | |
20 | |
21 // Provides gesture detection and dispatch given a sequence of touch events | |
22 // and touch event acks. | |
23 class ContentGestureProvider : public TouchDispositionGestureFilterClient, | |
24 public ui::GestureProviderClient { | |
25 public: | |
26 // TODO(jdduke): Move the scaling constant out of this class, instead hosting | |
27 // it on the generating MotionEvent. | |
28 ContentGestureProvider(ContentGestureProviderClient* client, | |
29 float touch_to_gesture_scale); | |
30 | |
31 // Returns true if |event| was both valid and successfully handled by the | |
32 // gesture detector. Otherwise, returns false, in which case the caller | |
33 // should drop |event|, not forwarding it to the renderer. | |
34 bool OnTouchEvent(const ui::MotionEvent& event); | |
35 | |
36 // To be called upon ack of an event that was forwarded after a successful | |
37 // call to |OnTouchEvent()|. | |
38 void OnTouchEventAck(InputEventAckState ack_state); | |
39 | |
40 // Methods delegated to |gesture_provider_|. | |
41 void ResetGestureDetectors(); | |
42 void CancelActiveTouchSequence(); | |
43 void UpdateMultiTouchSupport(bool support_multi_touch_zoom); | |
tdresser
2014/02/27 15:28:30
This would take some renaming to be consistent, bu
jdduke (slow)
2014/02/27 17:40:29
Done.
| |
44 void UpdateDoubleTapSupportForPlatform(bool support_double_tap); | |
45 void UpdateDoubleTapSupportForPage(bool support_double_tap); | |
46 | |
47 private: | |
48 // ui::GestureProviderClient | |
49 virtual void OnGestureEvent(const ui::GestureEventParams& params) OVERRIDE; | |
50 | |
51 // TouchDispositionGestureFilterClient | |
52 virtual void ForwardGestureEvent(const blink::WebGestureEvent& event) | |
53 OVERRIDE; | |
54 | |
55 ContentGestureProviderClient* const client_; | |
56 float touch_to_gesture_scale_; | |
57 | |
58 ui::GestureProvider gesture_provider_; | |
59 TouchDispositionGestureFilter gesture_filter_; | |
60 | |
61 bool handling_event_; | |
62 GestureEventPacket pending_gesture_packet_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(ContentGestureProvider); | |
65 }; | |
66 | |
67 } // namespace content | |
68 | |
69 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_CONTENT_GESTURE_PROVIDER_H_ | |
OLD | NEW |