Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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_smooth_drag_gesture.h" | |
| 6 | |
| 7 namespace content { | |
| 8 | |
| 9 SyntheticSmoothDragGesture::SyntheticSmoothDragGesture( | |
| 10 const SyntheticSmoothDragGestureParams& params) | |
| 11 : params_(params) { | |
| 12 } | |
| 13 | |
| 14 SyntheticSmoothDragGesture::~SyntheticSmoothDragGesture() { | |
| 15 } | |
| 16 | |
| 17 SyntheticGesture::Result SyntheticSmoothDragGesture::ForwardInputEvents( | |
| 18 const base::TimeTicks& timestamp, | |
| 19 SyntheticGestureTarget* target) { | |
| 20 if (move_gesture_ == nullptr) { | |
| 21 SyntheticGestureParams::GestureSourceType gesture_type = | |
| 22 params_.gesture_source_type; | |
| 23 if (gesture_type == SyntheticGestureParams::DEFAULT_INPUT) | |
| 24 gesture_type = target->GetDefaultSyntheticGestureSourceType(); | |
| 25 | |
| 26 if (gesture_type == SyntheticGestureParams::TOUCH_INPUT || | |
| 27 gesture_type == SyntheticGestureParams::MOUSE_INPUT) { | |
|
picksi
2015/02/20 11:51:18
IMO The logic to determine the gesture_type should
| |
| 28 InitializeMoveGesture(gesture_type); | |
| 29 } else | |
| 30 return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; | |
| 31 } | |
| 32 return move_gesture_->ForwardInputEvents(timestamp, target); | |
| 33 } | |
| 34 | |
| 35 SyntheticSmoothMoveGesture::InputType | |
| 36 SyntheticSmoothDragGesture::GetInputSourceType( | |
| 37 SyntheticGestureParams::GestureSourceType gesture_source_type) { | |
| 38 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) | |
| 39 return SyntheticSmoothMoveGesture::MOUSE_DRAG_INPUT; | |
| 40 else | |
| 41 return SyntheticSmoothMoveGesture::TOUCH_DRAG_INPUT; | |
| 42 } | |
| 43 | |
| 44 void SyntheticSmoothDragGesture::InitializeMoveGesture( | |
| 45 SyntheticGestureParams::GestureSourceType gesture_type) { | |
| 46 bool prevent_fling = true; | |
| 47 move_gesture_.reset(new SyntheticSmoothMoveGesture( | |
| 48 GetInputSourceType(gesture_type), params_.start_point, params_.distances, | |
| 49 params_.speed_in_pixels_s, prevent_fling)); | |
| 50 } | |
| 51 | |
| 52 } // namespace content | |
| OLD | NEW |