gesture_event_data.cc revision c5cede9ae108bb15f6b7a8aea21c7e1fefa2834c
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 3// found in the LICENSE file. 4 5#include "ui/events/gesture_detection/gesture_event_data.h" 6 7#include "base/logging.h" 8 9namespace ui { 10 11GestureEventData::GestureEventData(EventType type, 12 int motion_event_id, 13 base::TimeTicks time, 14 float x, 15 float y, 16 int touch_point_count, 17 const GestureEventDetails& details) 18 : type(type), 19 motion_event_id(motion_event_id), 20 time(time), 21 x(x), 22 y(y), 23 details(details) { 24 DCHECK(motion_event_id >= 0); 25 DCHECK_NE(0, touch_point_count); 26 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); 27 this->details.set_touch_points(touch_point_count); 28} 29 30GestureEventData::GestureEventData(EventType type, 31 int motion_event_id, 32 base::TimeTicks time, 33 float x, 34 float y, 35 int touch_point_count) 36 : type(type), 37 motion_event_id(motion_event_id), 38 time(time), 39 x(x), 40 y(y), 41 details(GestureEventDetails(type, 0, 0)) { 42 DCHECK(motion_event_id >= 0); 43 DCHECK_NE(0, touch_point_count); 44 DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END); 45 details.set_touch_points(touch_point_count); 46} 47 48GestureEventData::GestureEventData() : type(ET_UNKNOWN), x(0), y(0) {} 49 50} // namespace ui 51