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

Unified Diff: content/browser/renderer_host/input/synthetic_touch_driver.cc

Issue 2478423002: Rename SyntheticPointer to SyntheticPointerDriver (Closed)
Patch Set: rename Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/synthetic_touch_driver.cc
diff --git a/content/browser/renderer_host/input/synthetic_touch_driver.cc b/content/browser/renderer_host/input/synthetic_touch_driver.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cb77e663422b6114c70e449ae9ae0886d325636e
--- /dev/null
+++ b/content/browser/renderer_host/input/synthetic_touch_driver.cc
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/input/synthetic_touch_driver.h"
+
+#include "content/browser/renderer_host/input/synthetic_gesture_target.h"
+
+namespace content {
+
+SyntheticTouchDriver::SyntheticTouchDriver() {
+ std::fill(index_map_.begin(), index_map_.end(), -1);
+}
+
+SyntheticTouchDriver::SyntheticTouchDriver(SyntheticWebTouchEvent touch_event)
+ : touch_event_(touch_event) {
+ std::fill(index_map_.begin(), index_map_.end(), -1);
+}
+
+SyntheticTouchDriver::~SyntheticTouchDriver() {}
+
+void SyntheticTouchDriver::DispatchEvent(SyntheticGestureTarget* target,
+ const base::TimeTicks& timestamp) {
+ touch_event_.timeStampSeconds = ConvertTimestampToSeconds(timestamp);
+ target->DispatchInputEventToPlatform(touch_event_);
+}
+
+int SyntheticTouchDriver::Press(int index,
+ float x,
+ float y,
+ SyntheticGestureTarget* target,
+ const base::TimeTicks& timestamp) {
+ int point_index = touch_event_.PressPoint(x, y);
+ index_map_[index] = point_index;
+ return index;
+}
+
+void SyntheticTouchDriver::Move(int index,
+ float x,
+ float y,
+ SyntheticGestureTarget* target,
+ const base::TimeTicks& timestamp) {
+ touch_event_.MovePoint(index_map_[index], x, y);
+}
+
+void SyntheticTouchDriver::Release(int index,
+ SyntheticGestureTarget* target,
+ const base::TimeTicks& timestamp) {
+ touch_event_.ReleasePoint(index_map_[index]);
+ index_map_[index] = -1;
+}
+
+SyntheticGestureParams::GestureSourceType SyntheticTouchDriver::SourceType()
+ const {
+ return SyntheticGestureParams::TOUCH_INPUT;
+}
+
+int SyntheticTouchDriver::GetPointIndex(int index) const {
+ return index_map_[index];
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698