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

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

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
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 #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
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
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
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic.h ('k') | ui/events/gesture_detection/motion_event_generic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698