| 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 #ifndef CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR | 5 #ifndef CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR |
| 6 #define CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR | 6 #define CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "content/common/input/gesture_event_stream_validator.h" | 10 #include "content/common/input/gesture_event_stream_validator.h" |
| 11 #include "content/common/input/touch_event_stream_validator.h" |
| 9 | 12 |
| 10 namespace blink { | 13 namespace blink { |
| 11 class WebInputEvent; | 14 class WebInputEvent; |
| 12 } | 15 } |
| 13 | 16 |
| 14 namespace content { | 17 namespace content { |
| 15 | 18 |
| 16 // DCHECKs that the stream of WebInputEvents passed to OnEvent is | 19 // DCHECKs that the stream of WebInputEvents passed to OnEvent is |
| 17 // valid. Currently only validates WebGestureEvents. | 20 // valid. Currently only validates touch and touchscreen gesture events. |
| 18 class InputEventStreamValidator { | 21 class InputEventStreamValidator { |
| 19 public: | 22 public: |
| 20 InputEventStreamValidator(); | 23 InputEventStreamValidator(); |
| 21 ~InputEventStreamValidator(); | 24 ~InputEventStreamValidator(); |
| 22 void OnEvent(const blink::WebInputEvent&); | 25 |
| 26 void Validate(const blink::WebInputEvent&); |
| 23 | 27 |
| 24 private: | 28 private: |
| 29 bool ValidateImpl(const blink::WebInputEvent&, std::string* error_msg); |
| 30 |
| 25 GestureEventStreamValidator gesture_validator_; | 31 GestureEventStreamValidator gesture_validator_; |
| 26 bool enabled_; | 32 TouchEventStreamValidator touch_validator_; |
| 33 std::string error_msg_; |
| 34 const bool enabled_; |
| 27 | 35 |
| 28 DISALLOW_COPY_AND_ASSIGN(InputEventStreamValidator); | 36 DISALLOW_COPY_AND_ASSIGN(InputEventStreamValidator); |
| 29 }; | 37 }; |
| 30 | 38 |
| 31 } // namespace content | 39 } // namespace content |
| 32 | 40 |
| 33 #endif // CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR | 41 #endif // CONTENT_COMMON_INPUT_EVENT_STREAM_VALIDATOR |
| OLD | NEW |