OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 void RenderWidgetHostImpl::OnPointerEventActivate() { | 977 void RenderWidgetHostImpl::OnPointerEventActivate() { |
978 } | 978 } |
979 | 979 |
980 void RenderWidgetHostImpl::ForwardWheelEvent( | 980 void RenderWidgetHostImpl::ForwardWheelEvent( |
981 const WebMouseWheelEvent& wheel_event) { | 981 const WebMouseWheelEvent& wheel_event) { |
982 ForwardWheelEventWithLatencyInfo(wheel_event, NewInputLatencyInfo()); | 982 ForwardWheelEventWithLatencyInfo(wheel_event, NewInputLatencyInfo()); |
983 } | 983 } |
984 | 984 |
985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 985 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
986 const WebMouseWheelEvent& wheel_event, | 986 const WebMouseWheelEvent& wheel_event, |
987 const cc::LatencyInfo& latency_info) { | 987 const ui::LatencyInfo& latency_info) { |
988 TRACE_EVENT0("renderer_host", | 988 TRACE_EVENT0("renderer_host", |
989 "RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo"); | 989 "RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo"); |
990 if (ignore_input_events_ || process_->IgnoreInputEvents()) | 990 if (ignore_input_events_ || process_->IgnoreInputEvents()) |
991 return; | 991 return; |
992 | 992 |
993 if (delegate_->PreHandleWheelEvent(wheel_event)) | 993 if (delegate_->PreHandleWheelEvent(wheel_event)) |
994 return; | 994 return; |
995 | 995 |
996 // If there's already a mouse wheel event waiting to be sent to the renderer, | 996 // If there's already a mouse wheel event waiting to be sent to the renderer, |
997 // add the new deltas to that event. Not doing so (e.g., by dropping the old | 997 // add the new deltas to that event. Not doing so (e.g., by dropping the old |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), latency_info, | 1040 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), latency_info, |
1041 false); | 1041 false); |
1042 } | 1042 } |
1043 | 1043 |
1044 void RenderWidgetHostImpl::ForwardGestureEvent( | 1044 void RenderWidgetHostImpl::ForwardGestureEvent( |
1045 const WebKit::WebGestureEvent& gesture_event) { | 1045 const WebKit::WebGestureEvent& gesture_event) { |
1046 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardGestureEvent"); | 1046 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardGestureEvent"); |
1047 if (ignore_input_events_ || process_->IgnoreInputEvents()) | 1047 if (ignore_input_events_ || process_->IgnoreInputEvents()) |
1048 return; | 1048 return; |
1049 | 1049 |
1050 cc::LatencyInfo latency_info = NewInputLatencyInfo(); | 1050 ui::LatencyInfo latency_info = NewInputLatencyInfo(); |
1051 | 1051 |
1052 if (!IsInOverscrollGesture() && | 1052 if (!IsInOverscrollGesture() && |
1053 !gesture_event_filter_->ShouldForward( | 1053 !gesture_event_filter_->ShouldForward( |
1054 GestureEventWithLatencyInfo(gesture_event, latency_info))) | 1054 GestureEventWithLatencyInfo(gesture_event, latency_info))) |
1055 return; | 1055 return; |
1056 | 1056 |
1057 ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), | 1057 ForwardInputEvent(gesture_event, sizeof(WebGestureEvent), |
1058 latency_info, false); | 1058 latency_info, false); |
1059 } | 1059 } |
1060 | 1060 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 } | 1195 } |
1196 | 1196 |
1197 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1197 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
1198 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1198 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
1199 } | 1199 } |
1200 | 1200 |
1201 int64 RenderWidgetHostImpl::GetLatencyComponentId() { | 1201 int64 RenderWidgetHostImpl::GetLatencyComponentId() { |
1202 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); | 1202 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); |
1203 } | 1203 } |
1204 | 1204 |
1205 cc::LatencyInfo RenderWidgetHostImpl::NewInputLatencyInfo() { | 1205 ui::LatencyInfo RenderWidgetHostImpl::NewInputLatencyInfo() { |
1206 cc::LatencyInfo info; | 1206 ui::LatencyInfo info; |
1207 info.AddLatencyNumber( | 1207 info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_COMPONENT, |
1208 cc::kInputEvent, GetLatencyComponentId(), ++last_input_number_); | 1208 GetLatencyComponentId(), |
| 1209 ++last_input_number_); |
1209 return info; | 1210 return info; |
1210 } | 1211 } |
1211 | 1212 |
1212 void RenderWidgetHostImpl::SendInputEvent(const WebInputEvent& input_event, | 1213 void RenderWidgetHostImpl::SendInputEvent(const WebInputEvent& input_event, |
1213 int event_size, | 1214 int event_size, |
1214 const cc::LatencyInfo& latency_info, | 1215 const ui::LatencyInfo& latency_info, |
1215 bool is_keyboard_shortcut) { | 1216 bool is_keyboard_shortcut) { |
1216 input_event_start_time_ = TimeTicks::Now(); | 1217 input_event_start_time_ = TimeTicks::Now(); |
1217 Send(new InputMsg_HandleInputEvent( | 1218 Send(new InputMsg_HandleInputEvent( |
1218 routing_id_, &input_event, latency_info, is_keyboard_shortcut)); | 1219 routing_id_, &input_event, latency_info, is_keyboard_shortcut)); |
1219 increment_in_flight_event_count(); | 1220 increment_in_flight_event_count(); |
1220 } | 1221 } |
1221 | 1222 |
1222 void RenderWidgetHostImpl::ForwardInputEvent( | 1223 void RenderWidgetHostImpl::ForwardInputEvent( |
1223 const WebInputEvent& input_event, int event_size, | 1224 const WebInputEvent& input_event, int event_size, |
1224 const cc::LatencyInfo& latency_info, bool is_keyboard_shortcut) { | 1225 const ui::LatencyInfo& latency_info, bool is_keyboard_shortcut) { |
1225 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardInputEvent"); | 1226 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardInputEvent"); |
1226 | 1227 |
1227 if (!process_->HasConnection()) | 1228 if (!process_->HasConnection()) |
1228 return; | 1229 return; |
1229 | 1230 |
1230 DCHECK(!process_->IgnoreInputEvents()); | 1231 DCHECK(!process_->IgnoreInputEvents()); |
1231 | 1232 |
1232 if (overscroll_controller_.get() && | 1233 if (overscroll_controller_.get() && |
1233 !overscroll_controller_->WillDispatchEvent(input_event, latency_info)) { | 1234 !overscroll_controller_->WillDispatchEvent(input_event, latency_info)) { |
1234 // Reset the wheel-event state when appropriate. | 1235 // Reset the wheel-event state when appropriate. |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2467 if (!should_auto_resize_) | 2468 if (!should_auto_resize_) |
2468 return; | 2469 return; |
2469 | 2470 |
2470 OnRenderAutoResized(new_size); | 2471 OnRenderAutoResized(new_size); |
2471 } | 2472 } |
2472 | 2473 |
2473 void RenderWidgetHostImpl::DetachDelegate() { | 2474 void RenderWidgetHostImpl::DetachDelegate() { |
2474 delegate_ = NULL; | 2475 delegate_ = NULL; |
2475 } | 2476 } |
2476 | 2477 |
2477 void RenderWidgetHostImpl::FrameSwapped(const cc::LatencyInfo& latency_info) { | 2478 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
2478 } | 2479 } |
2479 | 2480 |
2480 } // namespace content | 2481 } // namespace content |
OLD | NEW |