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

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

Issue 2336803003: Make SyntheticPointerAction to flush the pointer action sequence (Closed)
Patch Set: controller Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/synthetic_pointer_action_controller.cc
diff --git a/content/browser/renderer_host/input/synthetic_pointer_action_controller.cc b/content/browser/renderer_host/input/synthetic_pointer_action_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c6d6562fd838083c1febe3b298aa333ab0a169e
--- /dev/null
+++ b/content/browser/renderer_host/input/synthetic_pointer_action_controller.cc
@@ -0,0 +1,46 @@
+// Copyright 2016 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_pointer_action_controller.h"
+
+namespace content {
+
+SyntheticPointerActionController::SyntheticPointerActionController() {
+ std::fill(index_map_.begin(), index_map_.end(), -1);
+}
+SyntheticPointerActionController::~SyntheticPointerActionController() {}
+
+std::unique_ptr<SyntheticGesture>
+SyntheticPointerActionController::CreateSyntheticPointerAction(
+ const SyntheticPointerActionListParams& gesture_params) {
+ if (!synthetic_pointer_)
+ SetSyntheticPointer(gesture_params);
+
+ std::unique_ptr<SyntheticGesture> synthetic_gesture =
+ std::unique_ptr<SyntheticGesture>(new SyntheticPointerAction(
+ gesture_params, synthetic_pointer_.get(), &index_map_));
+ return synthetic_gesture;
+}
+
+void SyntheticPointerActionController::SetSyntheticPointer(
+ const SyntheticPointerActionListParams& gesture_params) {
+ DCHECK_GE(gesture_params.param_list.size(), 0u);
+ SyntheticPointerActionParams action_params = gesture_params.param_list[0];
+
+ if (action_params.gesture_source_type ==
+ SyntheticGestureParams::DEFAULT_INPUT) {
+ action_params.gesture_source_type = default_type_;
+ }
+ DCHECK_NE(action_params.gesture_source_type,
+ SyntheticGestureParams::DEFAULT_INPUT);
+ synthetic_pointer_ =
+ SyntheticPointer::Create(action_params.gesture_source_type);
+}
+
+void SyntheticPointerActionController::SetDefaultGestureSourceType(
+ SyntheticGestureParams::GestureSourceType default_type) {
+ default_type_ = default_type;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698