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

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

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // Removes the PointerProperties at |index|. 87 // Removes the PointerProperties at |index|.
88 void RemovePointerAt(size_t index); 88 void RemovePointerAt(size_t index);
89 89
90 PointerProperties& pointer(size_t index) { return pointers_[index]; } 90 PointerProperties& pointer(size_t index) { return pointers_[index]; }
91 const PointerProperties& pointer(size_t index) const { 91 const PointerProperties& pointer(size_t index) const {
92 return pointers_[index]; 92 return pointers_[index];
93 } 93 }
94 94
95 // Add an event to the history. |this| and |event| must have the same pointer 95 // Add an event to the history. |this| and |event| must have the same pointer
96 // count and must both have an action of ACTION_MOVE. 96 // count and must both have an action of ACTION_MOVE.
97 void PushHistoricalEvent(scoped_ptr<MotionEvent> event); 97 void PushHistoricalEvent(std::unique_ptr<MotionEvent> event);
98 98
99 void set_action(Action action) { action_ = action; } 99 void set_action(Action action) { action_ = action; }
100 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; } 100 void set_event_time(base::TimeTicks event_time) { event_time_ = event_time; }
101 void set_unique_event_id(uint32_t unique_event_id) { 101 void set_unique_event_id(uint32_t unique_event_id) {
102 unique_event_id_ = unique_event_id; 102 unique_event_id_ = unique_event_id;
103 } 103 }
104 void set_action_index(int action_index) { action_index_ = action_index; } 104 void set_action_index(int action_index) { action_index_ = action_index; }
105 void set_button_state(int button_state) { button_state_ = button_state; } 105 void set_button_state(int button_state) { button_state_ = button_state; }
106 void set_flags(int flags) { flags_ = flags; } 106 void set_flags(int flags) { flags_ = flags; }
107 107
108 static scoped_ptr<MotionEventGeneric> CloneEvent(const MotionEvent& event); 108 static std::unique_ptr<MotionEventGeneric> CloneEvent(
109 static scoped_ptr<MotionEventGeneric> CancelEvent(const MotionEvent& event); 109 const MotionEvent& event);
110 static std::unique_ptr<MotionEventGeneric> CancelEvent(
111 const MotionEvent& event);
110 112
111 protected: 113 protected:
112 MotionEventGeneric(); 114 MotionEventGeneric();
113 MotionEventGeneric(const MotionEvent& event, bool with_history); 115 MotionEventGeneric(const MotionEvent& event, bool with_history);
114 MotionEventGeneric& operator=(const MotionEventGeneric& other); 116 MotionEventGeneric& operator=(const MotionEventGeneric& other);
115 117
116 void PopPointer(); 118 void PopPointer();
117 119
118 private: 120 private:
119 enum { kTypicalMaxPointerCount = 5 }; 121 enum { kTypicalMaxPointerCount = 5 };
120 122
121 Action action_; 123 Action action_;
122 base::TimeTicks event_time_; 124 base::TimeTicks event_time_;
123 uint32_t unique_event_id_; 125 uint32_t unique_event_id_;
124 int action_index_; 126 int action_index_;
125 int button_state_; 127 int button_state_;
126 int flags_; 128 int flags_;
127 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_; 129 base::StackVector<PointerProperties, kTypicalMaxPointerCount> pointers_;
128 ScopedVector<MotionEvent> historical_events_; 130 ScopedVector<MotionEvent> historical_events_;
129 }; 131 };
130 132
131 } // namespace ui 133 } // namespace ui
132 134
133 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_ 135 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_GENERIC_H_
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event_buffer_unittest.cc ('k') | ui/events/gesture_detection/motion_event_generic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698