Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / gestures / gesture_provider_aura.h
blob883d424e8c5bbb17d01d4cb3fbee9a0109d5651a
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.
5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_
6 #define UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_vector.h"
10 #include "ui/events/event.h"
11 #include "ui/events/events_export.h"
12 #include "ui/events/gesture_detection/filtered_gesture_provider.h"
13 #include "ui/events/gesture_detection/gesture_event_data_packet.h"
14 #include "ui/events/gesture_detection/touch_disposition_gesture_filter.h"
15 #include "ui/events/gestures/motion_event_aura.h"
17 namespace ui {
19 class EVENTS_EXPORT GestureProviderAuraClient {
20 public:
21 virtual ~GestureProviderAuraClient() {}
22 virtual void OnGestureEvent(GestureEvent* event) = 0;
25 // Provides gesture detection and dispatch given a sequence of touch events
26 // and touch event acks.
27 class EVENTS_EXPORT GestureProviderAura : public GestureProviderClient {
28 public:
29 GestureProviderAura(GestureProviderAuraClient* client);
30 virtual ~GestureProviderAura();
32 bool OnTouchEvent(const TouchEvent& event);
33 void OnTouchEventAck(bool event_consumed);
34 const MotionEventAura& pointer_state() { return pointer_state_; }
35 ScopedVector<GestureEvent>* GetAndResetPendingGestures();
37 // GestureProviderClient implementation
38 virtual void OnGestureEvent(const GestureEventData& gesture) OVERRIDE;
40 private:
41 bool IsConsideredDoubleTap(const GestureEventData& previous_tap,
42 const GestureEventData& current_tap) const;
44 scoped_ptr<GestureEventData> previous_tap_;
46 GestureProviderAuraClient* client_;
47 MotionEventAura pointer_state_;
48 FilteredGestureProvider filtered_gesture_provider_;
50 int last_touch_event_flags_;
51 ui::LatencyInfo last_touch_event_latency_info_;
52 bool handling_event_;
53 ScopedVector<GestureEvent> pending_gestures_;
55 DISALLOW_COPY_AND_ASSIGN(GestureProviderAura);
58 } // namespace ui
60 #endif // UI_EVENTS_GESTURE_DETECTION_UI_GESTURE_PROVIDER_H_