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 : SyntheticSmoothMoveGesture(params.gesture_source_type, |
| 12 params.start_point, |
| 13 params.distances, |
| 14 params.speed_in_pixels_s, |
| 15 true), |
| 16 params_(params) { |
| 17 } |
| 18 |
| 19 SyntheticSmoothDragGesture::~SyntheticSmoothDragGesture() { |
| 20 } |
| 21 |
| 22 SyntheticGesture::Result SyntheticSmoothDragGesture::ForwardInputEvents( |
| 23 const base::TimeTicks& timestamp, SyntheticGestureTarget* target) { |
| 24 if (state_ == SETUP) { |
| 25 if (gesture_source_type_ == SyntheticGestureParams::DEFAULT_INPUT) |
| 26 gesture_source_type_ = target->GetDefaultSyntheticGestureSourceType(); |
| 27 |
| 28 state_ = STARTED; |
| 29 current_move_segment_ = -1; |
| 30 current_move_segment_stop_time_ = timestamp; |
| 31 } |
| 32 |
| 33 DCHECK_NE(gesture_source_type_, SyntheticGestureParams::DEFAULT_INPUT); |
| 34 if (gesture_source_type_ == SyntheticGestureParams::TOUCH_INPUT) |
| 35 ForwardTouchInputEvents(timestamp, target); |
| 36 else if (gesture_source_type_ == SyntheticGestureParams::MOUSE_INPUT) |
| 37 ForwardMouseClickInputEvents(timestamp, target); |
| 38 else |
| 39 return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; |
| 40 |
| 41 return (state_ == DONE) ? SyntheticGesture::GESTURE_FINISHED |
| 42 : SyntheticGesture::GESTURE_RUNNING; |
| 43 } |
| 44 |
| 45 } // namespace content |
OLD | NEW |