gesture_event_data.cc revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
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(const GestureEventDetails& details,
12                                   int motion_event_id,
13                                   base::TimeTicks time,
14                                   float x,
15                                   float y,
16                                   int touch_point_count,
17                                   const gfx::RectF& bounding_box)
18    : details(details),
19      motion_event_id(motion_event_id),
20      time(time),
21      x(x),
22      y(y) {
23  DCHECK_GE(motion_event_id, 0);
24  DCHECK_NE(0, touch_point_count);
25  this->details.set_touch_points(touch_point_count);
26  this->details.set_bounding_box(bounding_box);
27}
28
29GestureEventData::GestureEventData(EventType type,
30                                   int motion_event_id,
31                                   base::TimeTicks time,
32                                   float x,
33                                   float y,
34                                   int touch_point_count,
35                                   const gfx::RectF& bounding_box)
36    : details(GestureEventDetails(type, 0, 0)),
37      motion_event_id(motion_event_id),
38      time(time),
39      x(x),
40      y(y) {
41  DCHECK_GE(motion_event_id, 0);
42  details.set_touch_points(touch_point_count);
43  details.set_bounding_box(bounding_box);
44}
45
46GestureEventData::GestureEventData() : x(0), y(0) {
47}
48
49}  //  namespace ui
50