| 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/gestures/motion_event_aura.h" | 5 #include "ui/events/gestures/motion_event_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/events/gestures/gesture_configuration.h" | 8 #include "ui/events/gestures/gesture_configuration.h" |
| 9 | 9 |
| 10 namespace ui { | 10 namespace ui { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 int MotionEventAura::GetId() const { | 76 int MotionEventAura::GetId() const { |
| 77 return GetPointerId(0); | 77 return GetPointerId(0); |
| 78 } | 78 } |
| 79 | 79 |
| 80 MotionEvent::Action MotionEventAura::GetAction() const { | 80 MotionEvent::Action MotionEventAura::GetAction() const { |
| 81 return cached_action_; | 81 return cached_action_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 int MotionEventAura::GetActionIndex() const { | 84 int MotionEventAura::GetActionIndex() const { |
| 85 DCHECK(cached_action_ == ACTION_POINTER_DOWN || | 85 if (cached_action_ != ACTION_POINTER_DOWN && |
| 86 cached_action_ == ACTION_POINTER_UP); | 86 cached_action_ != ACTION_POINTER_UP) { |
| 87 return -1; |
| 88 } |
| 87 DCHECK_GE(cached_action_index_, 0); | 89 DCHECK_GE(cached_action_index_, 0); |
| 88 DCHECK_LT(cached_action_index_, static_cast<int>(pointer_count_)); | 90 DCHECK_LT(cached_action_index_, static_cast<int>(pointer_count_)); |
| 89 return cached_action_index_; | 91 return cached_action_index_; |
| 90 } | 92 } |
| 91 | 93 |
| 92 size_t MotionEventAura::GetPointerCount() const { return pointer_count_; } | 94 size_t MotionEventAura::GetPointerCount() const { return pointer_count_; } |
| 93 | 95 |
| 94 int MotionEventAura::GetPointerId(size_t pointer_index) const { | 96 int MotionEventAura::GetPointerId(size_t pointer_index) const { |
| 95 DCHECK_LT(pointer_index, pointer_count_); | 97 DCHECK_LT(pointer_index, pointer_count_); |
| 96 return active_touches_[pointer_index].touch_id; | 98 return active_touches_[pointer_index].touch_id; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 size_t MotionEventAura::GetIndexFromId(int id) const { | 233 size_t MotionEventAura::GetIndexFromId(int id) const { |
| 232 for (size_t i = 0; i < pointer_count_; ++i) { | 234 for (size_t i = 0; i < pointer_count_; ++i) { |
| 233 if (active_touches_[i].touch_id == id) | 235 if (active_touches_[i].touch_id == id) |
| 234 return i; | 236 return i; |
| 235 } | 237 } |
| 236 NOTREACHED(); | 238 NOTREACHED(); |
| 237 return 0; | 239 return 0; |
| 238 } | 240 } |
| 239 | 241 |
| 240 } // namespace ui | 242 } // namespace ui |
| OLD | NEW |