| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 const ui::LatencyInfo& latency_info) { | 96 const ui::LatencyInfo& latency_info) { |
| 97 host_->ForwardWheelEventWithLatencyInfo(web_wheel, latency_info); | 97 host_->ForwardWheelEventWithLatencyInfo(web_wheel, latency_info); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( | 100 void SyntheticGestureTargetBase::DispatchWebMouseEventToPlatform( |
| 101 const blink::WebMouseEvent& web_mouse, | 101 const blink::WebMouseEvent& web_mouse, |
| 102 const ui::LatencyInfo& latency_info) { | 102 const ui::LatencyInfo& latency_info) { |
| 103 host_->ForwardMouseEventWithLatencyInfo(web_mouse, latency_info); | 103 host_->ForwardMouseEventWithLatencyInfo(web_mouse, latency_info); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SyntheticGestureTargetBase::SetNeedsFlush() { | |
| 107 host_->SetNeedsFlush(); | |
| 108 } | |
| 109 | |
| 110 SyntheticGestureParams::GestureSourceType | 106 SyntheticGestureParams::GestureSourceType |
| 111 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { | 107 SyntheticGestureTargetBase::GetDefaultSyntheticGestureSourceType() const { |
| 112 return SyntheticGestureParams::MOUSE_INPUT; | 108 return SyntheticGestureParams::MOUSE_INPUT; |
| 113 } | 109 } |
| 114 | 110 |
| 115 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() | 111 base::TimeDelta SyntheticGestureTargetBase::PointerAssumedStoppedTime() |
| 116 const { | 112 const { |
| 117 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); | 113 return base::TimeDelta::FromMilliseconds(kPointerAssumedStoppedTimeMs); |
| 118 } | 114 } |
| 119 | 115 |
| 120 float SyntheticGestureTargetBase::GetTouchSlopInDips() const { | 116 float SyntheticGestureTargetBase::GetTouchSlopInDips() const { |
| 121 return kTouchSlopInDips; | 117 return kTouchSlopInDips; |
| 122 } | 118 } |
| 123 | 119 |
| 124 float SyntheticGestureTargetBase::GetMinScalingSpanInDips() const { | 120 float SyntheticGestureTargetBase::GetMinScalingSpanInDips() const { |
| 125 // The minimum scaling distance is only relevant for touch gestures and the | 121 // The minimum scaling distance is only relevant for touch gestures and the |
| 126 // base target doesn't support touch. | 122 // base target doesn't support touch. |
| 127 NOTREACHED(); | 123 NOTREACHED(); |
| 128 return 0.0f; | 124 return 0.0f; |
| 129 } | 125 } |
| 130 | 126 |
| 131 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { | 127 bool SyntheticGestureTargetBase::PointIsWithinContents(int x, int y) const { |
| 132 gfx::Rect bounds = host_->GetView()->GetViewBounds(); | 128 gfx::Rect bounds = host_->GetView()->GetViewBounds(); |
| 133 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). | 129 bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). |
| 134 return bounds.Contains(x, y); | 130 return bounds.Contains(x, y); |
| 135 } | 131 } |
| 136 | 132 |
| 137 } // namespace content | 133 } // namespace content |
| OLD | NEW |