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..0a3de5e24dd8ed42e125fbead3c265f0c2f9483b |
--- /dev/null |
+++ b/content/browser/renderer_host/input/synthetic_pointer_action_controller.cc |
@@ -0,0 +1,42 @@ |
+// 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) { |
tdresser
2016/10/26 18:28:40
If the synthetic pointer was already set, this sil
lanwei
2016/10/30 23:23:13
You mean adding a DCHECK here for gesture_source_t
tdresser
2016/10/31 14:22:57
I'm proposing we add a DCHECK in the case where ge
|
+ gesture_source_type = default_type_; |
+ } |
+ DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT); |
+ synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type); |
+} |
+ |
+void SyntheticPointerActionController::SetDefaultGestureSourceType( |
+ SyntheticGestureParams::GestureSourceType default_type) { |
+ default_type_ = default_type; |
+} |
+ |
+} // namespace content |