Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: content/common/input/input_event_stream_validator.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebInputEvent.h" 10 #include "third_party/WebKit/public/platform/WebInputEvent.h"
(...skipping 18 matching lines...) Expand all
29 return; 29 return;
30 30
31 DCHECK(ValidateImpl(event, &error_msg_)) 31 DCHECK(ValidateImpl(event, &error_msg_))
32 << error_msg_ 32 << error_msg_
33 << "\nInvalid Event: " << ui::WebInputEventTraits::ToString(event); 33 << "\nInvalid Event: " << ui::WebInputEventTraits::ToString(event);
34 } 34 }
35 35
36 bool InputEventStreamValidator::ValidateImpl(const blink::WebInputEvent& event, 36 bool InputEventStreamValidator::ValidateImpl(const blink::WebInputEvent& event,
37 std::string* error_msg) { 37 std::string* error_msg) {
38 DCHECK(error_msg); 38 DCHECK(error_msg);
39 if (WebInputEvent::isGestureEventType(event.type)) { 39 if (WebInputEvent::isGestureEventType(event.type())) {
40 const WebGestureEvent& gesture = static_cast<const WebGestureEvent&>(event); 40 const WebGestureEvent& gesture = static_cast<const WebGestureEvent&>(event);
41 // TODO(jdduke): Validate touchpad gesture streams. 41 // TODO(jdduke): Validate touchpad gesture streams.
42 if (gesture.sourceDevice == blink::WebGestureDeviceTouchscreen) 42 if (gesture.sourceDevice == blink::WebGestureDeviceTouchscreen)
43 return gesture_validator_.Validate(gesture, error_msg); 43 return gesture_validator_.Validate(gesture, error_msg);
44 } else if (WebInputEvent::isTouchEventType(event.type)) { 44 } else if (WebInputEvent::isTouchEventType(event.type())) {
45 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event); 45 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(event);
46 return touch_validator_.Validate(touch, error_msg); 46 return touch_validator_.Validate(touch, error_msg);
47 } 47 }
48 return true; 48 return true;
49 } 49 }
50 50
51 } // namespace content 51 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698