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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 // now, we can send the next mouse move event | 1233 // now, we can send the next mouse move event |
1234 if (next_mouse_move_.get()) { | 1234 if (next_mouse_move_.get()) { |
1235 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); | 1235 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); |
1236 ForwardMouseEvent(*next_mouse_move_); | 1236 ForwardMouseEvent(*next_mouse_move_); |
1237 } | 1237 } |
1238 } else if (WebInputEvent::isKeyboardEventType(type)) { | 1238 } else if (WebInputEvent::isKeyboardEventType(type)) { |
1239 ProcessKeyboardEventAck(type, processed); | 1239 ProcessKeyboardEventAck(type, processed); |
1240 } else if (type == WebInputEvent::MouseWheel) { | 1240 } else if (type == WebInputEvent::MouseWheel) { |
1241 ProcessWheelAck(processed); | 1241 ProcessWheelAck(processed); |
1242 } else if (WebInputEvent::isTouchEventType(type)) { | 1242 } else if (WebInputEvent::isTouchEventType(type)) { |
1243 ProcessTouchAck(event_type, processed); | 1243 ProcessTouchAck(processed); |
1244 } | 1244 } |
1245 // This is used only for testing. | 1245 // This is used only for testing. |
1246 content::NotificationService::current()->Notify( | 1246 content::NotificationService::current()->Notify( |
1247 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, | 1247 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, |
1248 content::Source<RenderWidgetHostImpl>(this), | 1248 content::Source<RenderWidgetHostImpl>(this), |
1249 content::Details<int>(&type)); | 1249 content::Details<int>(&type)); |
1250 } | 1250 } |
1251 | 1251 |
1252 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { | 1252 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { |
1253 mouse_wheel_pending_ = false; | 1253 mouse_wheel_pending_ = false; |
1254 | 1254 |
1255 // Now send the next (coalesced) mouse wheel event. | 1255 // Now send the next (coalesced) mouse wheel event. |
1256 if (!coalesced_mouse_wheel_events_.empty()) { | 1256 if (!coalesced_mouse_wheel_events_.empty()) { |
1257 WebMouseWheelEvent next_wheel_event = | 1257 WebMouseWheelEvent next_wheel_event = |
1258 coalesced_mouse_wheel_events_.front(); | 1258 coalesced_mouse_wheel_events_.front(); |
1259 coalesced_mouse_wheel_events_.pop_front(); | 1259 coalesced_mouse_wheel_events_.pop_front(); |
1260 ForwardWheelEvent(next_wheel_event); | 1260 ForwardWheelEvent(next_wheel_event); |
1261 } | 1261 } |
1262 | 1262 |
1263 if (!processed && !is_hidden_ && view_) | 1263 if (!processed && !is_hidden_ && view_) |
1264 view_->UnhandledWheelEvent(current_wheel_event_); | 1264 view_->UnhandledWheelEvent(current_wheel_event_); |
1265 } | 1265 } |
1266 | 1266 |
1267 void RenderWidgetHostImpl::ProcessTouchAck( | 1267 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) { |
1268 WebInputEvent::Type type, bool processed) { | |
1269 if (view_) | 1268 if (view_) |
1270 view_->ProcessTouchAck(type, processed); | 1269 view_->ProcessTouchAck(processed); |
1271 } | 1270 } |
1272 | 1271 |
1273 void RenderWidgetHostImpl::OnMsgFocus() { | 1272 void RenderWidgetHostImpl::OnMsgFocus() { |
1274 // Only RenderViewHost can deal with that message. | 1273 // Only RenderViewHost can deal with that message. |
1275 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); | 1274 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); |
1276 process()->ReceivedBadMessage(); | 1275 process()->ReceivedBadMessage(); |
1277 } | 1276 } |
1278 | 1277 |
1279 void RenderWidgetHostImpl::OnMsgBlur() { | 1278 void RenderWidgetHostImpl::OnMsgBlur() { |
1280 // Only RenderViewHost can deal with that message. | 1279 // Only RenderViewHost can deal with that message. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1611 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1610 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1612 } | 1611 } |
1613 | 1612 |
1614 // static | 1613 // static |
1615 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1614 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
1616 int gpu_host_id) { | 1615 int gpu_host_id) { |
1617 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1616 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1618 if (ui_shim) | 1617 if (ui_shim) |
1619 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1618 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1620 } | 1619 } |
OLD | NEW |