Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / ui / events / gesture_detection / gesture_event_data.cc
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
9 namespace ui {
10
11 GestureEventData::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 gfx::RectF& bounding_box,
18                                    const GestureEventDetails& details)
19     : type(type),
20       motion_event_id(motion_event_id),
21       time(time),
22       x(x),
23       y(y),
24       details(details) {
25   DCHECK(motion_event_id >= 0);
26   DCHECK_NE(0, touch_point_count);
27   DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END);
28   this->details.set_touch_points(touch_point_count);
29   this->details.set_bounding_box(bounding_box);
30 }
31
32 GestureEventData::GestureEventData(EventType type,
33                                    int motion_event_id,
34                                    base::TimeTicks time,
35                                    float x,
36                                    float y,
37                                    int touch_point_count,
38                                    const gfx::RectF& bounding_box)
39     : type(type),
40       motion_event_id(motion_event_id),
41       time(time),
42       x(x),
43       y(y),
44       details(GestureEventDetails(type, 0, 0)) {
45   DCHECK(motion_event_id >= 0);
46   DCHECK_NE(0, touch_point_count);
47   DCHECK(ET_GESTURE_TYPE_START <= type && type <= ET_GESTURE_TYPE_END);
48   details.set_touch_points(touch_point_count);
49   details.set_bounding_box(bounding_box);
50 }
51
52 GestureEventData::GestureEventData() : type(ET_UNKNOWN), x(0), y(0) {}
53
54 }  //  namespace ui