OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/renderer_host/input/synthetic_pointer_action_controlle
r.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 SyntheticPointerActionController::SyntheticPointerActionController() { |
| 10 std::fill(index_map_.begin(), index_map_.end(), -1); |
| 11 } |
| 12 SyntheticPointerActionController::~SyntheticPointerActionController() {} |
| 13 |
| 14 std::unique_ptr<SyntheticGesture> |
| 15 SyntheticPointerActionController::CreateSyntheticPointerAction( |
| 16 const SyntheticPointerActionListParams& gesture_params) { |
| 17 if (!synthetic_pointer_) |
| 18 SetSyntheticPointer(gesture_params); |
| 19 |
| 20 std::unique_ptr<SyntheticGesture> synthetic_gesture = |
| 21 std::unique_ptr<SyntheticGesture>(new SyntheticPointerAction( |
| 22 gesture_params, synthetic_pointer_.get(), &index_map_)); |
| 23 return synthetic_gesture; |
| 24 } |
| 25 |
| 26 void SyntheticPointerActionController::SetSyntheticPointer( |
| 27 const SyntheticPointerActionListParams& gesture_params) { |
| 28 DCHECK_GE(gesture_params.param_list.size(), 0u); |
| 29 SyntheticPointerActionParams action_params = gesture_params.param_list[0]; |
| 30 |
| 31 if (action_params.gesture_source_type == |
| 32 SyntheticGestureParams::DEFAULT_INPUT) { |
| 33 action_params.gesture_source_type = default_type_; |
| 34 } |
| 35 DCHECK_NE(action_params.gesture_source_type, |
| 36 SyntheticGestureParams::DEFAULT_INPUT); |
| 37 synthetic_pointer_ = |
| 38 SyntheticPointer::Create(action_params.gesture_source_type); |
| 39 } |
| 40 |
| 41 void SyntheticPointerActionController::SetDefaultGestureSourceType( |
| 42 SyntheticGestureParams::GestureSourceType default_type) { |
| 43 default_type_ = default_type; |
| 44 } |
| 45 |
| 46 } // namespace content |
OLD | NEW |