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 "content/browser/renderer_host/input/motion_event_web.h" | 5 #include "content/browser/renderer_host/input/motion_event_web.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 using blink::WebInputEvent; | 9 using blink::WebInputEvent; |
10 using blink::WebTouchEvent; | 10 using blink::WebTouchEvent; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 MotionEventWeb::MotionEventWeb(const WebTouchEvent& event) | 63 MotionEventWeb::MotionEventWeb(const WebTouchEvent& event) |
64 : event_(event), | 64 : event_(event), |
65 cached_action_(GetActionFrom(event)), | 65 cached_action_(GetActionFrom(event)), |
66 cached_action_index_(GetActionIndexFrom(event)) { | 66 cached_action_index_(GetActionIndexFrom(event)) { |
67 DCHECK_GT(GetPointerCount(), 0U); | 67 DCHECK_GT(GetPointerCount(), 0U); |
68 } | 68 } |
69 | 69 |
70 MotionEventWeb::~MotionEventWeb() {} | 70 MotionEventWeb::~MotionEventWeb() {} |
71 | 71 |
| 72 int MotionEventWeb::GetId() const { |
| 73 return 0; |
| 74 } |
| 75 |
72 MotionEventWeb::Action MotionEventWeb::GetAction() const { | 76 MotionEventWeb::Action MotionEventWeb::GetAction() const { |
73 return cached_action_; | 77 return cached_action_; |
74 } | 78 } |
75 | 79 |
76 int MotionEventWeb::GetActionIndex() const { return cached_action_index_; } | 80 int MotionEventWeb::GetActionIndex() const { return cached_action_index_; } |
77 | 81 |
78 size_t MotionEventWeb::GetPointerCount() const { return event_.touchesLength; } | 82 size_t MotionEventWeb::GetPointerCount() const { return event_.touchesLength; } |
79 | 83 |
80 int MotionEventWeb::GetPointerId(size_t pointer_index) const { | 84 int MotionEventWeb::GetPointerId(size_t pointer_index) const { |
81 DCHECK_LT(pointer_index, GetPointerCount()); | 85 DCHECK_LT(pointer_index, GetPointerCount()); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 WebTouchEvent cancel_event(event_); | 147 WebTouchEvent cancel_event(event_); |
144 | 148 |
145 cancel_event.type = WebInputEvent::TouchCancel; | 149 cancel_event.type = WebInputEvent::TouchCancel; |
146 for (size_t i = 0; i < cancel_event.touchesLength; ++i) | 150 for (size_t i = 0; i < cancel_event.touchesLength; ++i) |
147 cancel_event.touches[i].state = WebTouchPoint::StateCancelled; | 151 cancel_event.touches[i].state = WebTouchPoint::StateCancelled; |
148 | 152 |
149 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); | 153 return scoped_ptr<MotionEvent>(new MotionEventWeb(cancel_event)); |
150 } | 154 } |
151 | 155 |
152 } // namespace content | 156 } // namespace content |
OLD | NEW |