| 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/input_event_stream_validator.h" | 5 #include "content/common/input/input_event_stream_validator.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/public/common/content_switches.h" | 9 #include "content/public/common/content_switches.h" |
| 10 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 10 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return; | 30 return; |
| 31 | 31 |
| 32 DCHECK(ValidateImpl(event, &error_msg_)) | 32 DCHECK(ValidateImpl(event, &error_msg_)) |
| 33 << error_msg_ | 33 << error_msg_ |
| 34 << "\nInvalid Event: " << ui::WebInputEventTraits::ToString(event); | 34 << "\nInvalid Event: " << ui::WebInputEventTraits::ToString(event); |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool InputEventStreamValidator::ValidateImpl(const blink::WebInputEvent& event, | 37 bool InputEventStreamValidator::ValidateImpl(const blink::WebInputEvent& event, |
| 38 std::string* error_msg) { | 38 std::string* error_msg) { |
| 39 DCHECK(error_msg); | 39 DCHECK(error_msg); |
| 40 if (WebInputEvent::isGestureEventType(event.type)) { | 40 if (WebInputEvent::isGestureEventType(event.type())) { |
| 41 const WebGestureEvent& gesture = static_cast<const WebGestureEvent&>(event); | 41 const WebGestureEvent& gesture = static_cast<const WebGestureEvent&>(event); |
| 42 // TODO(jdduke): Validate touchpad gesture streams. | 42 // TODO(jdduke): Validate touchpad gesture streams. |
| 43 if (gesture.sourceDevice == blink::WebGestureDeviceTouchscreen) | 43 if (gesture.sourceDevice == blink::WebGestureDeviceTouchscreen) |
| 44 return gesture_validator_.Validate(gesture, error_msg); | 44 return gesture_validator_.Validate(gesture, error_msg); |
| 45 } else if (WebInputEvent::isTouchEventType(event.type)) { | 45 } else if (WebInputEvent::isTouchEventType(event.type())) { |
| 46 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); | 46 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); |
| 47 return touch_validator_.Validate(touch, error_msg); | 47 return touch_validator_.Validate(touch, error_msg); |
| 48 } | 48 } |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace content | 52 } // namespace content |
| OLD | NEW |