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