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..a60fc2c07e940d7356fd0ca9c4fa141d6b78a754 |
--- /dev/null |
+++ b/content/browser/renderer_host/input/synthetic_pointer_action_controller.cc |
@@ -0,0 +1,45 @@ |
+// 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) { |
+ SyntheticGestureParams::GestureSourceType gesture_source_type = |
+ gesture_params.gesture_source_type; |
+ if (gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT) |
+ gesture_source_type = default_type_; |
+ DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT); |
+ synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type); |
+} |
+ |
+void SyntheticPointerActionController::ResetSyntheticPointer() { |
+ synthetic_pointer_.reset(); |
+} |
+ |
+void SyntheticPointerActionController::SetDefaultGestureSourceType( |
+ SyntheticGestureParams::GestureSourceType default_type) { |
+ default_type_ = default_type; |
+} |
+ |
+} // namespace content |