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 |