| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 y(y), | 28 y(y), |
| 29 raw_x(x), | 29 raw_x(x), |
| 30 raw_y(y), | 30 raw_y(y), |
| 31 pressure(0), | 31 pressure(0), |
| 32 touch_major(0), | 32 touch_major(0), |
| 33 touch_minor(0), | 33 touch_minor(0), |
| 34 orientation(0) { | 34 orientation(0) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 MotionEventGeneric::MotionEventGeneric() | 37 MotionEventGeneric::MotionEventGeneric() |
| 38 : action_(ACTION_CANCEL), id_(0), action_index_(0), button_state_(0) { | 38 : action_(ACTION_CANCEL), |
| 39 id_(0), |
| 40 action_index_(0), |
| 41 button_state_(0), |
| 42 flags_(0) { |
| 39 } | 43 } |
| 40 | 44 |
| 41 MotionEventGeneric::MotionEventGeneric(Action action, | 45 MotionEventGeneric::MotionEventGeneric(Action action, |
| 42 base::TimeTicks event_time, | 46 base::TimeTicks event_time, |
| 43 const PointerProperties& pointer) | 47 const PointerProperties& pointer) |
| 44 : action_(action), | 48 : action_(action), |
| 45 event_time_(event_time), | 49 event_time_(event_time), |
| 46 id_(0), | 50 id_(0), |
| 47 action_index_(0), | 51 action_index_(0), |
| 48 button_state_(0) { | 52 button_state_(0), |
| 53 flags_(0) { |
| 49 PushPointer(pointer); | 54 PushPointer(pointer); |
| 50 } | 55 } |
| 51 | 56 |
| 52 MotionEventGeneric::MotionEventGeneric(const MotionEventGeneric& other) | 57 MotionEventGeneric::MotionEventGeneric(const MotionEventGeneric& other) |
| 53 : action_(other.action_), | 58 : action_(other.action_), |
| 54 event_time_(other.event_time_), | 59 event_time_(other.event_time_), |
| 55 id_(other.id_), | 60 id_(other.id_), |
| 56 action_index_(other.action_index_), | 61 action_index_(other.action_index_), |
| 57 button_state_(other.button_state_), | 62 button_state_(other.button_state_), |
| 63 flags_(other.flags_), |
| 58 pointers_(other.pointers_) { | 64 pointers_(other.pointers_) { |
| 59 } | 65 } |
| 60 | 66 |
| 61 MotionEventGeneric::~MotionEventGeneric() { | 67 MotionEventGeneric::~MotionEventGeneric() { |
| 62 } | 68 } |
| 63 | 69 |
| 64 int MotionEventGeneric::GetId() const { | 70 int MotionEventGeneric::GetId() const { |
| 65 return id_; | 71 return id_; |
| 66 } | 72 } |
| 67 | 73 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 MotionEvent::ToolType MotionEventGeneric::GetToolType( | 131 MotionEvent::ToolType MotionEventGeneric::GetToolType( |
| 126 size_t pointer_index) const { | 132 size_t pointer_index) const { |
| 127 DCHECK_LT(pointer_index, pointers_->size()); | 133 DCHECK_LT(pointer_index, pointers_->size()); |
| 128 return pointers_[pointer_index].tool_type; | 134 return pointers_[pointer_index].tool_type; |
| 129 } | 135 } |
| 130 | 136 |
| 131 int MotionEventGeneric::GetButtonState() const { | 137 int MotionEventGeneric::GetButtonState() const { |
| 132 return button_state_; | 138 return button_state_; |
| 133 } | 139 } |
| 134 | 140 |
| 141 int MotionEventGeneric::GetFlags() const { |
| 142 return flags_; |
| 143 } |
| 144 |
| 135 base::TimeTicks MotionEventGeneric::GetEventTime() const { | 145 base::TimeTicks MotionEventGeneric::GetEventTime() const { |
| 136 return event_time_; | 146 return event_time_; |
| 137 } | 147 } |
| 138 | 148 |
| 139 scoped_ptr<MotionEvent> MotionEventGeneric::Clone() const { | 149 scoped_ptr<MotionEvent> MotionEventGeneric::Clone() const { |
| 140 return scoped_ptr<MotionEvent>(new MotionEventGeneric(*this)); | 150 return scoped_ptr<MotionEvent>(new MotionEventGeneric(*this)); |
| 141 } | 151 } |
| 142 | 152 |
| 143 scoped_ptr<MotionEvent> MotionEventGeneric::Cancel() const { | 153 scoped_ptr<MotionEvent> MotionEventGeneric::Cancel() const { |
| 144 scoped_ptr<MotionEventGeneric> event(new MotionEventGeneric(*this)); | 154 scoped_ptr<MotionEventGeneric> event(new MotionEventGeneric(*this)); |
| 145 event->set_action(ACTION_CANCEL); | 155 event->set_action(ACTION_CANCEL); |
| 146 return event.PassAs<MotionEvent>(); | 156 return event.PassAs<MotionEvent>(); |
| 147 } | 157 } |
| 148 | 158 |
| 149 void MotionEventGeneric::PushPointer(const PointerProperties& pointer) { | 159 void MotionEventGeneric::PushPointer(const PointerProperties& pointer) { |
| 150 pointers_->push_back(pointer); | 160 pointers_->push_back(pointer); |
| 151 } | 161 } |
| 152 | 162 |
| 153 void MotionEventGeneric::PopPointer() { | 163 void MotionEventGeneric::PopPointer() { |
| 154 DCHECK_GT(pointers_->size(), 0U); | 164 DCHECK_GT(pointers_->size(), 0U); |
| 155 pointers_->pop_back(); | 165 pointers_->pop_back(); |
| 156 } | 166 } |
| 157 | 167 |
| 158 } // namespace ui | 168 } // namespace ui |
| OLD | NEW |