1a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// found in the LICENSE file.
4a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
5a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "ui/events/gesture_detection/gesture_event_data.h"
6a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
7a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)#include "base/logging.h"
8a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
9a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)namespace ui {
10a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
11f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)GestureEventData::GestureEventData(const GestureEventDetails& details,
12c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch                                   int motion_event_id,
136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)                                   MotionEvent::ToolType primary_tool_type,
14a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                   base::TimeTicks time,
15a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                   float x,
16a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                                   float y,
176d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                                   float raw_x,
186d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                                   float raw_y,
196d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                                   size_t touch_point_count,
201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                   const gfx::RectF& bounding_box,
211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                   int flags)
22f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)    : details(details),
23c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      motion_event_id(motion_event_id),
246e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      primary_tool_type(primary_tool_type),
25c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      time(time),
26c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      x(x),
276d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      y(y),
286d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      raw_x(raw_x),
291320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      raw_y(raw_y),
301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      flags(flags) {
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  DCHECK_GE(motion_event_id, 0);
326d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  DCHECK_NE(0U, touch_point_count);
336d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  this->details.set_touch_points(static_cast<int>(touch_point_count));
340529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  this->details.set_bounding_box(bounding_box);
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
37effb81e5f8246d0db0270817048dc992db66e9fbBen MurdochGestureEventData::GestureEventData(EventType type,
386d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                                   const GestureEventData& other)
391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci    : details(type),
406d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      motion_event_id(other.motion_event_id),
416e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      primary_tool_type(other.primary_tool_type),
426d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      time(other.time),
436d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      x(other.x),
446d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      y(other.y),
456d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      raw_x(other.raw_x),
461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      raw_y(other.raw_y),
471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      flags(other.flags) {
486d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  details.set_touch_points(other.details.touch_points());
496d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  details.set_bounding_box(other.details.bounding_box_f());
50effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch}
51effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
526d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)GestureEventData::GestureEventData()
536e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)    : motion_event_id(0),
546e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      primary_tool_type(MotionEvent::TOOL_TYPE_UNKNOWN),
556e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      x(0),
566e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      y(0),
576e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)      raw_x(0),
581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      raw_y(0),
591320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      flags(EF_NONE) {
60f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)}
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)}  //  namespace ui
63