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

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

Issue 1035793003: Exposes more mutation functions to MotionEventGeneric (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
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event_generic.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 size_t GetHistorySize() const override; 63 size_t GetHistorySize() const override;
64 base::TimeTicks GetHistoricalEventTime( 64 base::TimeTicks GetHistoricalEventTime(
65 size_t historical_index) const override; 65 size_t historical_index) const override;
66 float GetHistoricalTouchMajor(size_t pointer_index, 66 float GetHistoricalTouchMajor(size_t pointer_index,
67 size_t historical_index) const override; 67 size_t historical_index) const override;
68 float GetHistoricalX(size_t pointer_index, 68 float GetHistoricalX(size_t pointer_index,
69 size_t historical_index) const override; 69 size_t historical_index) const override;
70 float GetHistoricalY(size_t pointer_index, 70 float GetHistoricalY(size_t pointer_index,
71 size_t historical_index) const override; 71 size_t historical_index) const override;
72 72
73 void PushPointer(const PointerProperties& pointer); 73 // Adds |pointer| to the set of pointers returning the index it was added at.
74 size_t PushPointer(const PointerProperties& pointer);
75
76 // Removes the PointerProperties at |index|.
77 void RemovePointerAt(size_t index);
78
79 PointerProperties& pointer(size_t index) { return pointers_[index]; }
80 const PointerProperties& pointer(size_t index) const {
81 return pointers_[index];
82 }
74 83
75 // Add an event to the history. |this| and |event| must have the same pointer 84 // 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. 85 // count and must both have an action of ACTION_MOVE.
77 void PushHistoricalEvent(scoped_ptr<MotionEvent> event); 86 void PushHistoricalEvent(scoped_ptr<MotionEvent> event);
78 87
79 void set_action(Action action) { action_ = action; } 88 void set_action(Action action) { action_ = action; }
80 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; } 89 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; }
81 void set_id(int id) { id_ = id; } 90 void set_id(int id) { id_ = id; }
82 void set_action_index(int action_index) { action_index_ = action_index; } 91 void set_action_index(int action_index) { action_index_ = action_index; }
83 void set_button_state(int button_state) { button_state_ = button_state; } 92 void set_button_state(int button_state) { button_state_ = button_state; }
84 void set_flags(int flags) { flags_ = flags; } 93 void set_flags(int flags) { flags_ = flags; }
85 94
86 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event); 95 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event);
87 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event); 96 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event);
88 97
89 protected: 98 protected:
90 MotionEventGeneric(); 99 MotionEventGeneric();
91 MotionEventGeneric(const MotionEvent& event, bool with_history); 100 MotionEventGeneric(const MotionEvent& event, bool with_history);
92 MotionEventGeneric& operator=(const MotionEventGeneric& other); 101 MotionEventGeneric& operator=(const MotionEventGeneric& other);
93 102
94 void PopPointer(); 103 void PopPointer();
95 104
96 PointerProperties& pointer(size_t index) { return pointers_[index]; }
97 const PointerProperties& pointer(size_t index) const {
98 return pointers_[index];
99 }
100
101 private: 105 private:
102 enum { kTypicalMaxPointerCount = 5 }; 106 enum { kTypicalMaxPointerCount = 5 };
103 107
104 Action action_; 108 Action action_;
105 base::TimeTicks event_time_; 109 base::TimeTicks event_time_;
106 int id_; 110 int id_;
107 int action_index_; 111 int action_index_;
108 int button_state_; 112 int button_state_;
109 int flags_; 113 int flags_;
110 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; 114 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_;
111 ScopedVector<MotionEvent> historical_events_; 115 ScopedVector<MotionEvent> historical_events_;
112 }; 116 };
113 117
114 } // namespace ui 118 } // namespace ui
115 119
116 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ 120 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/gesture_detection/motion_event_generic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698