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_messages.h" | 10 #include "content/common/input_messages.h" |
(...skipping 10 matching lines...) Expand all Loading... |
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 and Aura. | 25 // fling on Android and Aura. |
26 const int kPointerAssumedStoppedTimeMs = 100; | 26 const int kPointerAssumedStoppedTimeMs = 100; |
27 | 27 |
28 // SyntheticGestureTargetBase passes input events straight on to the renderer | 28 // SyntheticGestureTargetBase passes input events straight on to the renderer |
29 // without going through a gesture recognition framework. There is thus no touch | 29 // without going through a gesture recognition framework. There is thus no touch |
30 // slop. | 30 // slop. |
31 const int kTouchSlopInDips = 0; | 31 const float kTouchSlopInDips = 0.0f; |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 SyntheticGestureTargetBase::SyntheticGestureTargetBase( | 35 SyntheticGestureTargetBase::SyntheticGestureTargetBase( |
36 RenderWidgetHostImpl* host) | 36 RenderWidgetHostImpl* host) |
37 : host_(host) { | 37 : host_(host) { |
38 DCHECK(host); | 38 DCHECK(host); |
39 } | 39 } |
40 | 40 |
41 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { | 41 SyntheticGestureTargetBase::~SyntheticGestureTargetBase() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 SyntheticGestureParams::GestureSourceType | 110 SyntheticGestureParams::GestureSourceType |
111 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { | 111 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { |
112 return SyntheticGestureParams::MOUSE_INPUT; | 112 return SyntheticGestureParams::MOUSE_INPUT; |
113 } | 113 } |
114 | 114 |
115 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() | 115 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() |
116 const { | 116 const { |
117 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); | 117 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); |
118 } | 118 } |
119 | 119 |
120 int SyntheticGestureTargetBase::GetTouchSlopInDips() const { | 120 float SyntheticGestureTargetBase::GetTouchSlopInDips() const { |
121 return kTouchSlopInDips; | 121 return kTouchSlopInDips; |
122 } | 122 } |
123 | 123 |
| 124 float SyntheticGestureTargetBase::GetMinScalingSpanInDips() const { |
| 125 // The minimum scaling distance is only relevant for touch gestures and the |
| 126 // base target doesn't support touch. |
| 127 NOTREACHED(); |
| 128 return 0.0f; |
| 129 } |
| 130 |
124 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { | 131 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { |
125 gfx::Rect bounds = host_->GetView()->GetViewBounds(); | 132 gfx::Rect bounds = host_->GetView()->GetViewBounds(); |
126 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). | 133 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). |
127 return bounds.Contains(x, y); | 134 return bounds.Contains(x, y); |
128 } | 135 } |
129 | 136 |
130 } // namespace content | 137 } // namespace content |
OLD | NEW |