Roll src/third_party/WebKit 88cc93e:f6ae725 (svn 200125:200141)
[chromium-blink-merge.git] / ui / events / gestures / motion_event_aura.h
bloba094c03c9113e188e7b0239655f928931163273d
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_MOTION_EVENT_H_
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_
8 #include <map>
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
12 #include "ui/events/event.h"
13 #include "ui/events/events_export.h"
14 #include "ui/events/gesture_detection/motion_event_generic.h"
16 namespace ui {
18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents.
19 class EVENTS_EXPORT MotionEventAura : public MotionEventGeneric {
20 public:
21 MotionEventAura();
22 ~MotionEventAura() override;
24 // MotionEventGeneric:
25 int GetSourceDeviceId(size_t pointer_index) const override;
27 // Returns true iff the touch was valid.
28 bool OnTouch(const TouchEvent& touch);
30 // We can't cleanup removed touch points immediately upon receipt of a
31 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report
32 // information about those touch events. Once the MotionEvent has been
33 // processed, we call CleanupRemovedTouchPoints to do the required
34 // book-keeping.
35 void CleanupRemovedTouchPoints(const TouchEvent& event);
37 private:
38 void AddTouch(const TouchEvent& touch);
39 void UpdateTouch(const TouchEvent& touch);
40 void UpdateCachedAction(const TouchEvent& touch);
41 int GetIndexFromId(int id) const;
43 DISALLOW_COPY_AND_ASSIGN(MotionEventAura);
46 } // namespace ui
48 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_