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 : drag_setup_(false), params_(params) { | |
|
picksi
2015/02/19 11:50:18
nit:drag_initialized might be a clearer name?
ssid
2015/02/20 10:58:54
Acknowledged.
| |
| 12 } | |
| 13 | |
| 14 SyntheticSmoothDragGesture::~SyntheticSmoothDragGesture() { | |
| 15 } | |
| 16 | |
| 17 SyntheticGesture::Result SyntheticSmoothDragGesture::ForwardInputEvents( | |
| 18 const base::TimeTicks& timestamp, | |
| 19 SyntheticGestureTarget* target) { | |
| 20 if (drag_setup_ == false) { | |
| 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) | |
|
Sami
2015/02/19 11:59:05
Use braces for multi-line if statements.
ssid
2015/02/20 10:58:54
Done.
| |
| 28 move_gesture_.reset(new SyntheticSmoothMoveGesture( | |
| 29 GetInputSourceType(gesture_type), params_.start_point, | |
| 30 params_.distances, params_.speed_in_pixels_s, true)); | |
|
picksi
2015/02/19 11:50:18
Would pixels_per_second be a better name than spee
Sami
2015/02/19 11:59:05
nit: please make prevent_fling a named variable to
ssid
2015/02/20 10:58:54
It was the name given in the previous versions. I
ssid
2015/02/20 10:58:54
IMO, Drag is dragging the screen, rather than flin
| |
| 31 else | |
| 32 return SyntheticGesture::GESTURE_SOURCE_TYPE_NOT_IMPLEMENTED; | |
| 33 | |
| 34 drag_setup_ = true; | |
| 35 } | |
|
picksi
2015/02/19 11:50:18
Can you move the initialization into its own init(
ssid
2015/02/20 10:58:54
Done.
| |
| 36 return move_gesture_->ForwardInputEvents(timestamp, target); | |
| 37 } | |
| 38 | |
| 39 SyntheticSmoothMoveGesture::InputType | |
| 40 SyntheticSmoothDragGesture::GetInputSourceType( | |
| 41 SyntheticGestureParams::GestureSourceType gesture_source_type) { | |
| 42 if (gesture_source_type == SyntheticGestureParams::MOUSE_INPUT) | |
| 43 return SyntheticSmoothMoveGesture::MOUSE_CLICK; | |
| 44 else | |
| 45 return SyntheticSmoothMoveGesture::TOUCH_INPUT; | |
| 46 } | |
| 47 | |
| 48 } // namespace content | |
| OLD | NEW |