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/common/input/touch_event_stream_validator.h" | 5 #include "content/common/input/touch_event_stream_validator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 | 9 |
10 using blink::WebInputEvent; | 10 using blink::WebInputEvent; |
11 using blink::WebTouchEvent; | 11 using blink::WebTouchEvent; |
12 using blink::WebTouchPoint; | 12 using blink::WebTouchPoint; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 namespace { | 15 namespace { |
16 | 16 |
17 const WebTouchPoint* FindTouchPoint(const WebTouchEvent& event, int id) { | 17 const WebTouchPoint* FindTouchPoint(const WebTouchEvent& event, int id) { |
18 for (unsigned i = 0; i < event.touchesLength; ++i) { | 18 for (unsigned i = 0; i < event.touchesLength; ++i) { |
19 if (event.touches[i].id == id) | 19 if (event.touches[i].id == id) |
20 return &event.touches[i]; | 20 return &event.touches[i]; |
21 } | 21 } |
22 return NULL; | 22 return nullptr; |
23 } | 23 } |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 TouchEventStreamValidator::TouchEventStreamValidator() { | 27 TouchEventStreamValidator::TouchEventStreamValidator() { |
28 } | 28 } |
29 | 29 |
30 TouchEventStreamValidator::~TouchEventStreamValidator() { | 30 TouchEventStreamValidator::~TouchEventStreamValidator() { |
31 } | 31 } |
32 | 32 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 if (!found_valid_state_for_type) | 123 if (!found_valid_state_for_type) |
124 error_msg->append("No valid touch point corresponding to event type."); | 124 error_msg->append("No valid touch point corresponding to event type."); |
125 | 125 |
126 return error_msg->empty(); | 126 return error_msg->empty(); |
127 } | 127 } |
128 | 128 |
129 } // namespace content | 129 } // namespace content |
OLD | NEW |