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 SyntheticGestureParams::GestureSourceType gesture_source_type = |
| 29 gesture_params.gesture_source_type; |
| 30 if (gesture_source_type == SyntheticGestureParams::DEFAULT_INPUT) |
| 31 gesture_source_type = default_type_; |
| 32 DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT); |
| 33 synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type); |
| 34 } |
| 35 |
| 36 void SyntheticPointerActionController::ResetSyntheticPointer() { |
| 37 synthetic_pointer_.reset(); |
| 38 } |
| 39 |
| 40 void SyntheticPointerActionController::SetDefaultGestureSourceType( |
| 41 SyntheticGestureParams::GestureSourceType default_type) { |
| 42 default_type_ = default_type; |
| 43 } |
| 44 |
| 45 } // namespace content |
OLD | NEW |