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

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

Issue 2478423002: Rename SyntheticPointer to SyntheticPointerDriver (Closed)
Patch Set: rename 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/input/synthetic_touch_driver.h"
6
7 #include "content/browser/renderer_host/input/synthetic_gesture_target.h"
8
9 using blink::WebTouchEvent;
10
11 namespace content {
12
13 SyntheticTouchDriver::SyntheticTouchDriver() {}
14
15 SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event)
16 : touch_event_(touch_event) {}
17
18 SyntheticTouchDriver::~SyntheticTouchDriver() {}
19
20 void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target,
21 const base::TimeTicks& timestamp) {
22 touch_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp);
23 target->DispatchInputEventToPlatform(touch_event_);
24 }
25
26 int SyntheticTouchDriver::Press(float x, float y) {
27 int index = touch_event_.PressPoint(x, y);
28 return index;
29 }
30
31 void SyntheticTouchDriver::Move(float x, float y, int index) {
32 touch_event_.MovePoint(index, x, y);
33 }
34
35 void SyntheticTouchDriver::Release(int index) {
36 touch_event_.ReleasePoint(index);
37 }
38
39 bool SyntheticTouchDriver::UserInputCheck(
40 const SyntheticPointerActionParams& params) const {
41 DCHECK_GE(params.index(), -1);
42 DCHECK_LT(params.index(), WebTouchEvent::kTouchesLengthCap);
43 if (params.gesture_source_type != SyntheticGestureParams::TOUCH_INPUT)
44 return false;
45
46 if (params.pointer_action_type() ==
47 SyntheticPointerActionParams::PointerActionType::NOT_INITIALIZED) {
48 return false;
49 }
50
51 if (params.pointer_action_type() ==
52 SyntheticPointerActionParams::PointerActionType::PRESS &&
53 params.index() >= 0) {
54 return false;
55 }
56
57 if (params.pointer_action_type() ==
58 SyntheticPointerActionParams::PointerActionType::MOVE &&
59 params.index() == -1) {
60 return false;
61 }
62
63 if (params.pointer_action_type() ==
64 SyntheticPointerActionParams::PointerActionType::RELEASE &&
65 params.index() == -1) {
66 return false;
67 }
68
69 return true;
70 }
71
72 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698