Chromium Code Reviews| 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) { | |
|
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
| |
| 31 gesture_source_type = default_type_; | |
| 32 } | |
| 33 DCHECK_NE(gesture_source_type, SyntheticGestureParams::DEFAULT_INPUT); | |
| 34 synthetic_pointer_ = SyntheticPointer::Create(gesture_source_type); | |
| 35 } | |
| 36 | |
| 37 void SyntheticPointerActionController::SetDefaultGestureSourceType( | |
| 38 SyntheticGestureParams::GestureSourceType default_type) { | |
| 39 default_type_ = default_type; | |
| 40 } | |
| 41 | |
| 42 } // namespace content | |
| OLD | NEW |