| 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_GESTURE_EVENT_STREAM_VALIDATOR | 5 #ifndef CONTENT_COMMON_INPUT_GESTURE_EVENT_STREAM_VALIDATOR |
| 6 #define CONTENT_COMMON_INPUT_GESTURE_EVENT_STREAM_VALIDATOR | 6 #define CONTENT_COMMON_INPUT_GESTURE_EVENT_STREAM_VALIDATOR |
| 7 | 7 |
| 8 #include <string> |
| 9 |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 | 11 |
| 10 namespace blink { | 12 namespace blink { |
| 11 class WebGestureEvent; | 13 class WebGestureEvent; |
| 12 } | 14 } |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // In debug mode, logs an error and exits if the stream of WebGestureEvents | 18 // Utility class for validating a stream of WebGestureEvents. |
| 17 // passed to Validate is invalid. | |
| 18 class GestureEventStreamValidator { | 19 class GestureEventStreamValidator { |
| 19 public: | 20 public: |
| 20 GestureEventStreamValidator(); | 21 GestureEventStreamValidator(); |
| 21 ~GestureEventStreamValidator(); | 22 ~GestureEventStreamValidator(); |
| 22 // Returns true iff |event| is valid for the current stream. | 23 |
| 23 bool Validate(const blink::WebGestureEvent& event, | 24 // If |event| is valid for the current stream, returns true. |
| 24 const char** error_message); | 25 // Otherwise, returns false with a corresponding error message. |
| 26 bool Validate(const blink::WebGestureEvent& event, std::string* error_msg); |
| 25 | 27 |
| 26 private: | 28 private: |
| 27 bool scrolling_; | 29 bool scrolling_; |
| 28 bool pinching_; | 30 bool pinching_; |
| 29 bool waiting_for_tap_end_; | 31 bool waiting_for_tap_end_; |
| 30 | 32 |
| 31 DISALLOW_COPY_AND_ASSIGN(GestureEventStreamValidator); | 33 DISALLOW_COPY_AND_ASSIGN(GestureEventStreamValidator); |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 } // namespace content | 36 } // namespace content |
| 35 | 37 |
| 36 #endif // CONTENT_COMMON_INPUT_GESTURE_EVENT_STREAM_VALIDATOR | 38 #endif // CONTENT_COMMON_INPUT_GESTURE_EVENT_STREAM_VALIDATOR |
| OLD | NEW |