Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_ | |
| 6 #define UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "ui/events/event.h" | |
| 10 #include "ui/events/events_export.h" | |
| 11 #include "ui/events/gesture_detection/filtered_gesture_provider.h" | |
| 12 #include "ui/events/gesture_detection/gesture_event_data_packet.h" | |
| 13 #include "ui/events/gesture_detection/motion_event_ui.h" | |
| 14 #include "ui/events/gesture_detection/touch_disposition_gesture_filter.h" | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 class EVENTS_EXPORT UIGestureProviderClient { | |
| 19 public: | |
| 20 virtual ~UIGestureProviderClient() {} | |
| 21 virtual void OnGestureEvent(GestureEvent* event) = 0; | |
|
jdduke (slow)
2014/05/02 17:56:43
scoped_ptr?
tdresser
2014/05/05 15:42:35
Yeah, that probably is clearer.
I've let the Gestu
| |
| 22 }; | |
| 23 | |
| 24 // Provides gesture detection and dispatch given a sequence of touch events | |
| 25 // and touch event acks. | |
| 26 class EVENTS_EXPORT UIGestureProvider : public FilteredGestureProvider { | |
|
jdduke (slow)
2014/05/02 17:56:43
GestureProviderAura?
tdresser
2014/05/05 15:42:35
Done.
| |
| 27 public: | |
|
jdduke (slow)
2014/05/02 17:56:43
Hmm, can we compose FilteredGestureProvider and in
tdresser
2014/05/05 15:42:35
Much, much better. Thanks for catching that!
Done.
| |
| 28 bool OnTouchEvent(const TouchEvent& event); | |
| 29 static UIGestureProvider* Create(UIGestureProviderClient* client); | |
| 30 virtual ~UIGestureProvider(); | |
| 31 const MotionEventUI& get_pointer_state() { return motion_event_; } | |
| 32 | |
| 33 private: | |
| 34 class GestureProviderClientConverter : public ui::GestureProviderClient { | |
| 35 public: | |
| 36 GestureProviderClientConverter(UIGestureProviderClient* client) | |
| 37 : client_(client), flags_(0) {} | |
| 38 | |
| 39 virtual ~GestureProviderClientConverter() {} | |
| 40 | |
| 41 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE; | |
| 42 void set_flags(int flags) { flags_ = flags; } | |
| 43 | |
| 44 private: | |
| 45 UIGestureProviderClient* client_; | |
| 46 int flags_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(GestureProviderClientConverter); | |
| 49 }; | |
| 50 | |
| 51 UIGestureProvider(scoped_ptr<GestureProviderClientConverter> converter); | |
| 52 scoped_ptr<GestureProviderClientConverter> converter_; | |
| 53 MotionEventUI motion_event_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(UIGestureProvider); | |
| 56 }; | |
| 57 | |
| 58 } // namespace ui | |
| 59 | |
| 60 #endif // UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_ | |
| OLD | NEW |