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

Side by Side Diff: content/browser/renderer_host/input/synthetic_touch_driver.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Rebase Created 3 years, 11 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser/renderer_host/input/synthetic_touch_driver.h" 5 #include "content/browser/renderer_host/input/synthetic_touch_driver.h"
6 6
7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" 7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 SyntheticTouchDriver::SyntheticTouchDriver() { 11 SyntheticTouchDriver::SyntheticTouchDriver() {
12 std::fill(index_map_.begin(), index_map_.end(), -1); 12 std::fill(index_map_.begin(), index_map_.end(), -1);
13 } 13 }
14 14
15 SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event) 15 SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event)
16 : touch_event_(touch_event) { 16 : touch_event_(touch_event) {
17 std::fill(index_map_.begin(), index_map_.end(), -1); 17 std::fill(index_map_.begin(), index_map_.end(), -1);
18 } 18 }
19 19
20 SyntheticTouchDriver::~SyntheticTouchDriver() {} 20 SyntheticTouchDriver::~SyntheticTouchDriver() {}
21 21
22 void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target, 22 void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target,
23 const base::TimeTicks& timestamp) { 23 const base::TimeTicks& timestamp) {
24 touch_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp); 24 touch_event_.setTimeStampSeconds(ConvertTimestampToSeconds(timestamp));
25 if (touch_event_.type != blink::WebInputEvent::Undefined) 25 target->DispatchInputEventToPlatform(touch_event_);
26 target->DispatchInputEventToPlatform(touch_event_);
27 touch_event_.ResetPoints(); 26 touch_event_.ResetPoints();
28 } 27 }
29 28
30 void SyntheticTouchDriver::Press(float x, float y, int index) { 29 void SyntheticTouchDriver::Press(float x, float y, int index) {
31 DCHECK_GE(index, 0); 30 DCHECK_GE(index, 0);
32 DCHECK_LT(index, blink::WebTouchEvent::kTouchesLengthCap); 31 DCHECK_LT(index, blink::WebTouchEvent::kTouchesLengthCap);
33 int touch_index = touch_event_.PressPoint(x, y); 32 int touch_index = touch_event_.PressPoint(x, y);
34 index_map_[index] = touch_index; 33 index_map_[index] = touch_index;
35 } 34 }
36 35
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (params.pointer_action_type() == 72 if (params.pointer_action_type() ==
74 SyntheticPointerActionParams::PointerActionType::RELEASE && 73 SyntheticPointerActionParams::PointerActionType::RELEASE &&
75 index_map_[params.index()] == -1) { 74 index_map_[params.index()] == -1) {
76 return false; 75 return false;
77 } 76 }
78 77
79 return true; 78 return true;
80 } 79 }
81 80
82 } // namespace content 81 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698