OLD | NEW |
(Empty) | |
| 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 |
| 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
" |
| 11 #include "ui/events/gesture_detection/gesture_provider.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 struct NativeWebTouchEvent; |
| 16 |
| 17 class ContentGestureProviderClient { |
| 18 public: |
| 19 virtual ~ContentGestureProviderClient() {} |
| 20 virtual void OnGestureEvent(const blink::WebGestureEvent& event) = 0; |
| 21 }; |
| 22 |
| 23 // Provides gesture detection and dispatch given a sequence of touch events |
| 24 // and touch event acks. |
| 25 class ContentGestureProvider : public TouchDispositionGestureFilterClient, |
| 26 public ui::GestureProviderClient { |
| 27 public: |
| 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 simply drop |event|. |
| 34 bool OnTouchEvent(const NativeWebTouchEvent& 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); |
| 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 |