| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" | 5 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 9 #include "content/browser/renderer_host/ui_events_helper.h" | 9 #include "content/browser/renderer_host/ui_events_helper.h" |
| 10 #include "content/common/input/input_event.h" | 10 #include "content/common/input/input_event.h" |
| 11 #include "content/common/input_messages.h" | 11 #include "content/common/input_messages.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 14 #include "ui/events/latency_info.h" | 14 #include "ui/events/latency_info.h" |
| 15 | 15 |
| 16 using blink::WebInputEvent; | 16 using blink::WebInputEvent; |
| 17 using blink::WebTouchEvent; | 17 using blink::WebTouchEvent; |
| 18 using blink::WebMouseEvent; | 18 using blink::WebMouseEvent; |
| 19 using blink::WebMouseWheelEvent; | 19 using blink::WebMouseWheelEvent; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // This value was determined experimentally. It was sufficient to not cause a | 24 // This value was determined experimentally. It was sufficient to not cause a |
| 25 // fling on Android. | 25 // fling on Android. |
| 26 const int kPointerAssumedStoppedTimeMs = 50; | 26 const int kPointerAssumedStoppedTimeMs = 50; |
| 27 | 27 |
| 28 // SyntheticGestureTargetBase passes input events straight on to the renderer |
| 29 // without going through a gesture recognition framework. There is thus no touch |
| 30 // slop. |
| 31 // On platforms where input events are processed by a gesture recognizer |
| 32 // GetTouchSlopInDips() should be overwritten. |
| 33 const int kTouchSlopInDips = 0; |
| 34 |
| 28 } // namespace | 35 } // namespace |
| 29 | 36 |
| 30 SyntheticGestureTargetBase::SyntheticGestureTargetBase( | 37 SyntheticGestureTargetBase::SyntheticGestureTargetBase( |
| 31 RenderWidgetHostImpl* host) | 38 RenderWidgetHostImpl* host) |
| 32 : host_(host) { | 39 : host_(host) { |
| 33 DCHECK(host); | 40 DCHECK(host); |
| 34 } | 41 } |
| 35 | 42 |
| 36 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { | 43 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { |
| 37 } | 44 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 SyntheticGestureParams::GestureSourceType gesture_source_type) const { | 110 SyntheticGestureParams::GestureSourceType gesture_source_type) const { |
| 104 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || | 111 return gesture_source_type == SyntheticGestureParams::MOUSE_INPUT || |
| 105 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; | 112 gesture_source_type == SyntheticGestureParams::TOUCH_INPUT; |
| 106 } | 113 } |
| 107 | 114 |
| 108 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() | 115 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() |
| 109 const { | 116 const { |
| 110 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); | 117 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); |
| 111 } | 118 } |
| 112 | 119 |
| 120 int SyntheticGestureTargetBase::GetTouchSlopInDips() const { |
| 121 return kTouchSlopInDips; |
| 122 } |
| 123 |
| 113 } // namespace content | 124 } // namespace content |
| OLD | NEW |