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

Side by Side Diff: ui/events/gesture_detection/motion_event_generic.h

Issue 999423003: Set the unique_event_id when converting from TouchEvent to WebTouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_
6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/stack_container.h" 9 #include "base/containers/stack_container.h"
10 #include "base/memory/scoped_vector.h" 10 #include "base/memory/scoped_vector.h"
(...skipping 26 matching lines...) Expand all
37 public: 37 public:
38 MotionEventGeneric(Action action, 38 MotionEventGeneric(Action action,
39 base::TimeTicks event_time, 39 base::TimeTicks event_time,
40 const PointerProperties& pointer); 40 const PointerProperties& pointer);
41 MotionEventGeneric(const MotionEventGeneric& other); 41 MotionEventGeneric(const MotionEventGeneric& other);
42 42
43 ~MotionEventGeneric() override; 43 ~MotionEventGeneric() override;
44 44
45 // MotionEvent implementation. 45 // MotionEvent implementation.
46 int GetId() const override; 46 int GetId() const override;
47 uint32 GetUniqueId() const override;
47 Action GetAction() const override; 48 Action GetAction() const override;
48 int GetActionIndex() const override; 49 int GetActionIndex() const override;
49 size_t GetPointerCount() const override; 50 size_t GetPointerCount() const override;
50 int GetPointerId(size_t pointer_index) const override; 51 int GetPointerId(size_t pointer_index) const override;
51 float GetX(size_t pointer_index) const override; 52 float GetX(size_t pointer_index) const override;
52 float GetY(size_t pointer_index) const override; 53 float GetY(size_t pointer_index) const override;
53 float GetRawX(size_t pointer_index) const override; 54 float GetRawX(size_t pointer_index) const override;
54 float GetRawY(size_t pointer_index) const override; 55 float GetRawY(size_t pointer_index) const override;
55 float GetTouchMajor(size_t pointer_index) const override; 56 float GetTouchMajor(size_t pointer_index) const override;
56 float GetTouchMinor(size_t pointer_index) const override; 57 float GetTouchMinor(size_t pointer_index) const override;
(...skipping 15 matching lines...) Expand all
72 73
73 void PushPointer(const PointerProperties& pointer); 74 void PushPointer(const PointerProperties& pointer);
74 75
75 // Add an event to the history. |this| and |event| must have the same pointer 76 // Add an event to the history. |this| and |event| must have the same pointer
76 // count and must both have an action of ACTION_MOVE. 77 // count and must both have an action of ACTION_MOVE.
77 void PushHistoricalEvent(scoped_ptr<MotionEvent> event); 78 void PushHistoricalEvent(scoped_ptr<MotionEvent> event);
78 79
79 void set_action(Action action) { action_ = action; } 80 void set_action(Action action) { action_ = action; }
80 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; } 81 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; }
81 void set_id(int id) { id_ = id; } 82 void set_id(int id) { id_ = id; }
83 void set_unique_id(uint32 unique_id) { unique_id_ = unique_id; }
82 void set_action_index(int action_index) { action_index_ = action_index; } 84 void set_action_index(int action_index) { action_index_ = action_index; }
83 void set_button_state(int button_state) { button_state_ = button_state; } 85 void set_button_state(int button_state) { button_state_ = button_state; }
84 void set_flags(int flags) { flags_ = flags; } 86 void set_flags(int flags) { flags_ = flags; }
85 87
86 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event); 88 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event);
87 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event); 89 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event);
88 90
89 protected: 91 protected:
90 MotionEventGeneric(); 92 MotionEventGeneric();
91 MotionEventGeneric(const MotionEvent& event, bool with_history); 93 MotionEventGeneric(const MotionEvent& event, bool with_history);
92 MotionEventGeneric& operator=(const MotionEventGeneric& other); 94 MotionEventGeneric& operator=(const MotionEventGeneric& other);
93 95
94 void PopPointer(); 96 void PopPointer();
95 97
96 PointerProperties& pointer(size_t index) { return pointers_[index]; } 98 PointerProperties& pointer(size_t index) { return pointers_[index]; }
97 const PointerProperties& pointer(size_t index) const { 99 const PointerProperties& pointer(size_t index) const {
98 return pointers_[index]; 100 return pointers_[index];
99 } 101 }
100 102
101 private: 103 private:
102 enum { kTypicalMaxPointerCount = 5 }; 104 enum { kTypicalMaxPointerCount = 5 };
103 105
104 Action action_; 106 Action action_;
105 base::TimeTicks event_time_; 107 base::TimeTicks event_time_;
106 int id_; 108 int id_;
109 uint32 unique_id_;
107 int action_index_; 110 int action_index_;
108 int button_state_; 111 int button_state_;
109 int flags_; 112 int flags_;
110 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; 113 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_;
111 ScopedVector<MotionEvent> historical_events_; 114 ScopedVector<MotionEvent> historical_events_;
112 }; 115 };
113 116
114 } // namespace ui 117 } // namespace ui
115 118
116 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ 119 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698