OLD | NEW |
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 #include "ui/events/gesture_detection/motion_event_generic.h" | 5 #include "ui/events/gesture_detection/motion_event_generic.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // static | 190 // static |
191 scoped_ptr<MotionEventGeneric> MotionEventGeneric::CancelEvent( | 191 scoped_ptr<MotionEventGeneric> MotionEventGeneric::CancelEvent( |
192 const MotionEvent& event) { | 192 const MotionEvent& event) { |
193 bool with_history = false; | 193 bool with_history = false; |
194 scoped_ptr<MotionEventGeneric> cancel_event( | 194 scoped_ptr<MotionEventGeneric> cancel_event( |
195 new MotionEventGeneric(event, with_history)); | 195 new MotionEventGeneric(event, with_history)); |
196 cancel_event->set_action(ACTION_CANCEL); | 196 cancel_event->set_action(ACTION_CANCEL); |
197 return cancel_event.Pass(); | 197 return cancel_event.Pass(); |
198 } | 198 } |
199 | 199 |
200 void MotionEventGeneric::PushPointer(const PointerProperties& pointer) { | 200 size_t MotionEventGeneric::PushPointer(const PointerProperties& pointer) { |
201 DCHECK_EQ(0U, GetHistorySize()); | 201 DCHECK_EQ(0U, GetHistorySize()); |
202 pointers_->push_back(pointer); | 202 pointers_->push_back(pointer); |
| 203 return pointers_->size() - 1; |
| 204 } |
| 205 |
| 206 void MotionEventGeneric::RemovePointerAt(size_t index) { |
| 207 DCHECK_LT(index, pointers_->size()); |
| 208 pointers_->erase(pointers_->begin() + index); |
203 } | 209 } |
204 | 210 |
205 void MotionEventGeneric::PushHistoricalEvent(scoped_ptr<MotionEvent> event) { | 211 void MotionEventGeneric::PushHistoricalEvent(scoped_ptr<MotionEvent> event) { |
206 DCHECK(event); | 212 DCHECK(event); |
207 DCHECK_EQ(event->GetAction(), ACTION_MOVE); | 213 DCHECK_EQ(event->GetAction(), ACTION_MOVE); |
208 DCHECK_EQ(event->GetPointerCount(), GetPointerCount()); | 214 DCHECK_EQ(event->GetPointerCount(), GetPointerCount()); |
209 DCHECK_EQ(event->GetAction(), GetAction()); | 215 DCHECK_EQ(event->GetAction(), GetAction()); |
210 DCHECK_LE(event->GetEventTime().ToInternalValue(), | 216 DCHECK_LE(event->GetEventTime().ToInternalValue(), |
211 GetEventTime().ToInternalValue()); | 217 GetEventTime().ToInternalValue()); |
212 historical_events_.push_back(event.release()); | 218 historical_events_.push_back(event.release()); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 PushHistoricalEvent(other.historical_events_[h]->Clone()); | 269 PushHistoricalEvent(other.historical_events_[h]->Clone()); |
264 return *this; | 270 return *this; |
265 } | 271 } |
266 | 272 |
267 void MotionEventGeneric::PopPointer() { | 273 void MotionEventGeneric::PopPointer() { |
268 DCHECK_GT(pointers_->size(), 0U); | 274 DCHECK_GT(pointers_->size(), 0U); |
269 pointers_->pop_back(); | 275 pointers_->pop_back(); |
270 } | 276 } |
271 | 277 |
272 } // namespace ui | 278 } // namespace ui |
OLD | NEW |