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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 // now, we can send the next mouse move event | 1246 // now, we can send the next mouse move event |
1247 if (next_mouse_move_.get()) { | 1247 if (next_mouse_move_.get()) { |
1248 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); | 1248 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); |
1249 ForwardMouseEvent(*next_mouse_move_); | 1249 ForwardMouseEvent(*next_mouse_move_); |
1250 } | 1250 } |
1251 } else if (WebInputEvent::isKeyboardEventType(type)) { | 1251 } else if (WebInputEvent::isKeyboardEventType(type)) { |
1252 ProcessKeyboardEventAck(type, processed); | 1252 ProcessKeyboardEventAck(type, processed); |
1253 } else if (type == WebInputEvent::MouseWheel) { | 1253 } else if (type == WebInputEvent::MouseWheel) { |
1254 ProcessWheelAck(processed); | 1254 ProcessWheelAck(processed); |
1255 } else if (WebInputEvent::isTouchEventType(type)) { | 1255 } else if (WebInputEvent::isTouchEventType(type)) { |
1256 ProcessTouchAck(processed); | 1256 ProcessTouchAck(event_type, processed); |
1257 } | 1257 } |
1258 // This is used only for testing. | 1258 // This is used only for testing. |
1259 content::NotificationService::current()->Notify( | 1259 content::NotificationService::current()->Notify( |
1260 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, | 1260 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, |
1261 content::Source<RenderWidgetHostImpl>(this), | 1261 content::Source<RenderWidgetHostImpl>(this), |
1262 content::Details<int>(&type)); | 1262 content::Details<int>(&type)); |
1263 } | 1263 } |
1264 | 1264 |
1265 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { | 1265 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { |
1266 mouse_wheel_pending_ = false; | 1266 mouse_wheel_pending_ = false; |
1267 | 1267 |
1268 // Now send the next (coalesced) mouse wheel event. | 1268 // Now send the next (coalesced) mouse wheel event. |
1269 if (!coalesced_mouse_wheel_events_.empty()) { | 1269 if (!coalesced_mouse_wheel_events_.empty()) { |
1270 WebMouseWheelEvent next_wheel_event = | 1270 WebMouseWheelEvent next_wheel_event = |
1271 coalesced_mouse_wheel_events_.front(); | 1271 coalesced_mouse_wheel_events_.front(); |
1272 coalesced_mouse_wheel_events_.pop_front(); | 1272 coalesced_mouse_wheel_events_.pop_front(); |
1273 ForwardWheelEvent(next_wheel_event); | 1273 ForwardWheelEvent(next_wheel_event); |
1274 } | 1274 } |
1275 | 1275 |
1276 if (!processed && !is_hidden_ && view_) | 1276 if (!processed && !is_hidden_ && view_) |
1277 view_->UnhandledWheelEvent(current_wheel_event_); | 1277 view_->UnhandledWheelEvent(current_wheel_event_); |
1278 } | 1278 } |
1279 | 1279 |
1280 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) { | 1280 void RenderWidgetHostImpl::ProcessTouchAck( |
| 1281 WebInputEvent::Type type, bool processed) { |
1281 if (view_) | 1282 if (view_) |
1282 view_->ProcessTouchAck(processed); | 1283 view_->ProcessTouchAck(type, processed); |
1283 } | 1284 } |
1284 | 1285 |
1285 void RenderWidgetHostImpl::OnMsgFocus() { | 1286 void RenderWidgetHostImpl::OnMsgFocus() { |
1286 // Only RenderViewHost can deal with that message. | 1287 // Only RenderViewHost can deal with that message. |
1287 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); | 1288 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); |
1288 process()->ReceivedBadMessage(); | 1289 process()->ReceivedBadMessage(); |
1289 } | 1290 } |
1290 | 1291 |
1291 void RenderWidgetHostImpl::OnMsgBlur() { | 1292 void RenderWidgetHostImpl::OnMsgBlur() { |
1292 // Only RenderViewHost can deal with that message. | 1293 // Only RenderViewHost can deal with that message. |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1632 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1632 } | 1633 } |
1633 | 1634 |
1634 // static | 1635 // static |
1635 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1636 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
1636 int gpu_host_id) { | 1637 int gpu_host_id) { |
1637 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1638 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1638 if (ui_shim) | 1639 if (ui_shim) |
1639 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1640 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1640 } | 1641 } |
OLD | NEW |