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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 is_unresponsive_(false), | 96 is_unresponsive_(false), |
97 in_flight_event_count_(0), | 97 in_flight_event_count_(0), |
98 in_get_backing_store_(false), | 98 in_get_backing_store_(false), |
99 view_being_painted_(false), | 99 view_being_painted_(false), |
100 ignore_input_events_(false), | 100 ignore_input_events_(false), |
101 text_direction_updated_(false), | 101 text_direction_updated_(false), |
102 text_direction_(WebKit::WebTextDirectionLeftToRight), | 102 text_direction_(WebKit::WebTextDirectionLeftToRight), |
103 text_direction_canceled_(false), | 103 text_direction_canceled_(false), |
104 suppress_next_char_events_(false), | 104 suppress_next_char_events_(false), |
105 pending_mouse_lock_request_(false), | 105 pending_mouse_lock_request_(false), |
| 106 has_touch_handler_(false), |
106 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 107 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
107 if (routing_id_ == MSG_ROUTING_NONE) { | 108 if (routing_id_ == MSG_ROUTING_NONE) { |
108 routing_id_ = process_->GetNextRoutingID(); | 109 routing_id_ = process_->GetNextRoutingID(); |
109 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( | 110 surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( |
110 process_->GetID(), | 111 process_->GetID(), |
111 routing_id_); | 112 routing_id_); |
112 } else { | 113 } else { |
113 // TODO(piman): This is a O(N) lookup, where we could forward the | 114 // TODO(piman): This is a O(N) lookup, where we could forward the |
114 // information from the RenderWidgetHelper. The problem is that doing so | 115 // information from the RenderWidgetHelper. The problem is that doing so |
115 // currently leaks outside of content all the way to chrome classes, and | 116 // currently leaks outside of content all the way to chrome classes, and |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) | 214 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) |
214 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 215 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
215 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 216 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
216 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 217 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
217 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) | 218 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) |
218 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) | 219 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) |
219 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) | 220 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) |
220 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 221 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
221 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 222 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
222 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 223 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 224 IPC_MESSAGE_HANDLER(ViewHostMsg_DidChangeNumTouchEvents, |
| 225 OnMsgDidChangeNumTouchEvents) |
223 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 226 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
224 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 227 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
225 OnMsgTextInputStateChanged) | 228 OnMsgTextInputStateChanged) |
226 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, | 229 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, |
227 OnMsgImeCompositionRangeChanged) | 230 OnMsgImeCompositionRangeChanged) |
228 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 231 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
229 OnMsgImeCancelComposition) | 232 OnMsgImeCancelComposition) |
230 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, | 233 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, |
231 OnMsgDidActivateAcceleratedCompositing) | 234 OnMsgDidActivateAcceleratedCompositing) |
232 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse) | 235 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse) |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); | 1203 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); |
1201 process()->ReceivedBadMessage(); | 1204 process()->ReceivedBadMessage(); |
1202 } | 1205 } |
1203 | 1206 |
1204 void RenderWidgetHost::OnMsgBlur() { | 1207 void RenderWidgetHost::OnMsgBlur() { |
1205 // Only RenderViewHost can deal with that message. | 1208 // Only RenderViewHost can deal with that message. |
1206 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); | 1209 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); |
1207 process()->ReceivedBadMessage(); | 1210 process()->ReceivedBadMessage(); |
1208 } | 1211 } |
1209 | 1212 |
| 1213 void RenderWidgetHost::OnMsgDidChangeNumTouchEvents(int count) { |
| 1214 has_touch_handler_ = count > 0; |
| 1215 } |
| 1216 |
1210 void RenderWidgetHost::OnMsgSetCursor(const WebCursor& cursor) { | 1217 void RenderWidgetHost::OnMsgSetCursor(const WebCursor& cursor) { |
1211 if (!view_) { | 1218 if (!view_) { |
1212 return; | 1219 return; |
1213 } | 1220 } |
1214 view_->UpdateCursor(cursor); | 1221 view_->UpdateCursor(cursor); |
1215 } | 1222 } |
1216 | 1223 |
1217 void RenderWidgetHost::OnMsgTextInputStateChanged( | 1224 void RenderWidgetHost::OnMsgTextInputStateChanged( |
1218 ui::TextInputType type, | 1225 ui::TextInputType type, |
1219 bool can_compose_inline) { | 1226 bool can_compose_inline) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1544 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1538 } | 1545 } |
1539 | 1546 |
1540 // static | 1547 // static |
1541 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, | 1548 void RenderWidgetHost::AcknowledgePostSubBuffer(int32 route_id, |
1542 int gpu_host_id) { | 1549 int gpu_host_id) { |
1543 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1550 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1544 if (ui_shim) | 1551 if (ui_shim) |
1545 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1552 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1546 } | 1553 } |
OLD | NEW |