Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: ui/events/gestures/motion_event_aura.h

Issue 789363004: WindowManagerApp should recognize gestures (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rename Aura to Impl and add FIXME Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/events/gestures/gesture_recognizer_impl.cc ('k') | ui/events/gestures/motion_event_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_MOTION_EVENT_H_
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_
7
8 #include <map>
9
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.h"
15
16 namespace ui {
17
18 // Implementation of MotionEvent which takes a stream of ui::TouchEvents.
19 class EVENTS_EXPORT MotionEventAura : public MotionEvent {
20 public:
21 MotionEventAura();
22 virtual ~MotionEventAura();
23
24 void OnTouch(const TouchEvent& touch);
25
26 // MotionEvent implementation.
27 virtual int GetId() const override;
28 virtual Action GetAction() const override;
29 virtual int GetActionIndex() const override;
30 virtual size_t GetPointerCount() const override;
31 virtual int GetPointerId(size_t pointer_index) const override;
32 virtual float GetX(size_t pointer_index) const override;
33 virtual float GetY(size_t pointer_index) const override;
34 virtual float GetRawX(size_t pointer_index) const override;
35 virtual float GetRawY(size_t pointer_index) const override;
36 virtual float GetTouchMajor(size_t pointer_index) const override;
37 virtual float GetTouchMinor(size_t pointer_index) const override;
38 virtual float GetOrientation(size_t pointer_index) const override;
39 virtual float GetPressure(size_t pointer_index) const override;
40 virtual ToolType GetToolType(size_t pointer_index) const override;
41 virtual int GetButtonState() const override;
42 virtual int GetFlags() const override;
43 virtual base::TimeTicks GetEventTime() const override;
44
45 virtual scoped_ptr<MotionEvent> Clone() const override;
46 virtual scoped_ptr<MotionEvent> Cancel() const override;
47
48 int GetSourceDeviceId(size_t pointer_index) const;
49
50 // We can't cleanup removed touch points immediately upon receipt of a
51 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report
52 // information about those touch events. Once the MotionEvent has been
53 // processed, we call CleanupRemovedTouchPoints to do the required
54 // book-keeping.
55 void CleanupRemovedTouchPoints(const TouchEvent& event);
56
57 private:
58 struct PointData {
59 PointData();
60 float x;
61 float y;
62 float raw_x;
63 float raw_y;
64 int touch_id;
65 float pressure;
66 int source_device_id;
67 float touch_major;
68 float touch_minor;
69 float orientation;
70 };
71
72 MotionEventAura(
73 size_t pointer_count,
74 const base::TimeTicks& last_touch_time,
75 Action cached_action,
76 int cached_action_index,
77 int flags,
78 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]);
79
80 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch);
81 void AddTouch(const TouchEvent& touch);
82 void UpdateTouch(const TouchEvent& touch);
83 void UpdateCachedAction(const TouchEvent& touch);
84 size_t GetIndexFromId(int id) const;
85
86 size_t pointer_count_;
87 base::TimeTicks last_touch_time_;
88 Action cached_action_;
89 // The index of the touch responsible for last ACTION_POINTER_DOWN or
90 // ACTION_POINTER_UP. -1 if no such action has occurred.
91 int cached_action_index_;
92 int flags_;
93
94 // We want constant time indexing by pointer_index, and fast indexing by id.
95 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT];
96
97 DISALLOW_COPY_AND_ASSIGN(MotionEventAura);
98 };
99
100 } // namespace ui
101
102 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_
OLDNEW
« no previous file with comments | « ui/events/gestures/gesture_recognizer_impl.cc ('k') | ui/events/gestures/motion_event_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698