| 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 <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 31 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
| 32 #include "content/browser/gpu/gpu_surface_tracker.h" | 32 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 33 #include "content/browser/renderer_host/backing_store.h" | 33 #include "content/browser/renderer_host/backing_store.h" |
| 34 #include "content/browser/renderer_host/backing_store_manager.h" | 34 #include "content/browser/renderer_host/backing_store_manager.h" |
| 35 #include "content/browser/renderer_host/dip_util.h" | 35 #include "content/browser/renderer_host/dip_util.h" |
| 36 #include "content/browser/renderer_host/input/input_router_impl.h" | 36 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 37 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 37 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
| 38 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" | 38 #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" |
| 39 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" | 39 #include "content/browser/renderer_host/input/synthetic_gesture_target.h" |
| 40 #include "content/browser/renderer_host/input/timeout_monitor.h" | 40 #include "content/browser/renderer_host/input/timeout_monitor.h" |
| 41 #include "content/browser/renderer_host/input/touch_emulator.h" |
| 41 #include "content/browser/renderer_host/overscroll_controller.h" | 42 #include "content/browser/renderer_host/overscroll_controller.h" |
| 42 #include "content/browser/renderer_host/render_process_host_impl.h" | 43 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 43 #include "content/browser/renderer_host/render_view_host_impl.h" | 44 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 44 #include "content/browser/renderer_host/render_widget_helper.h" | 45 #include "content/browser/renderer_host/render_widget_helper.h" |
| 45 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 46 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 46 #include "content/common/accessibility_messages.h" | 47 #include "content/common/accessibility_messages.h" |
| 47 #include "content/common/content_constants_internal.h" | 48 #include "content/common/content_constants_internal.h" |
| 48 #include "content/common/cursors/webcursor.h" | 49 #include "content/common/cursors/webcursor.h" |
| 49 #include "content/common/gpu/gpu_messages.h" | 50 #include "content/common/gpu/gpu_messages.h" |
| 50 #include "content/common/input_messages.h" | 51 #include "content/common/input_messages.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // If we're initially visible, tell the process host that we're alive. | 237 // If we're initially visible, tell the process host that we're alive. |
| 237 // Otherwise we'll notify the process host when we are first shown. | 238 // Otherwise we'll notify the process host when we are first shown. |
| 238 if (!hidden) | 239 if (!hidden) |
| 239 process_->WidgetRestored(); | 240 process_->WidgetRestored(); |
| 240 | 241 |
| 241 accessibility_mode_ = | 242 accessibility_mode_ = |
| 242 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); | 243 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); |
| 243 | 244 |
| 244 input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_)); | 245 input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_)); |
| 245 | 246 |
| 247 touch_emulator_.reset(); |
| 248 |
| 246 #if defined(USE_AURA) | 249 #if defined(USE_AURA) |
| 247 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> | 250 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> |
| 248 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 251 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
| 249 SetOverscrollControllerEnabled(overscroll_enabled); | 252 SetOverscrollControllerEnabled(overscroll_enabled); |
| 250 #endif | 253 #endif |
| 251 | 254 |
| 252 if (GetProcess()->IsGuest() || !CommandLine::ForCurrentProcess()->HasSwitch( | 255 if (GetProcess()->IsGuest() || !CommandLine::ForCurrentProcess()->HasSwitch( |
| 253 switches::kDisableHangMonitor)) { | 256 switches::kDisableHangMonitor)) { |
| 254 hang_monitor_timeout_.reset(new TimeoutMonitor( | 257 hang_monitor_timeout_.reset(new TimeoutMonitor( |
| 255 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 258 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) | 479 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
| 477 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 480 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
| 478 msg_is_ok = OnSwapCompositorFrame(msg)) | 481 msg_is_ok = OnSwapCompositorFrame(msg)) |
| 479 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) | 482 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) |
| 480 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) | 483 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) |
| 481 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 484 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
| 482 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) | 485 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) |
| 483 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) | 486 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) |
| 484 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) | 487 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) |
| 485 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | 488 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
| 489 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTouchEventEmulationEnabled, |
| 490 OnSetTouchEventEmulationEnabled) |
| 486 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, | 491 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, |
| 487 OnTextInputTypeChanged) | 492 OnTextInputTypeChanged) |
| 488 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 493 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| 489 OnImeCancelComposition) | 494 OnImeCancelComposition) |
| 490 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, | 495 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, |
| 491 OnDidActivateAcceleratedCompositing) | 496 OnDidActivateAcceleratedCompositing) |
| 492 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) | 497 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) |
| 493 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) | 498 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) |
| 494 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, | 499 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, |
| 495 OnShowDisambiguationPopup) | 500 OnShowDisambiguationPopup) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 // If there is a pending mouse lock request, we don't want to reject it at | 679 // If there is a pending mouse lock request, we don't want to reject it at |
| 675 // this point. The user can switch focus back to this view and approve the | 680 // this point. The user can switch focus back to this view and approve the |
| 676 // request later. | 681 // request later. |
| 677 if (IsMouseLocked()) | 682 if (IsMouseLocked()) |
| 678 view_->UnlockMouse(); | 683 view_->UnlockMouse(); |
| 679 | 684 |
| 680 // If there is a pending overscroll, then that should be cancelled. | 685 // If there is a pending overscroll, then that should be cancelled. |
| 681 if (overscroll_controller_) | 686 if (overscroll_controller_) |
| 682 overscroll_controller_->Cancel(); | 687 overscroll_controller_->Cancel(); |
| 683 | 688 |
| 689 if (touch_emulator_) |
| 690 touch_emulator_->CancelTouch(); |
| 691 |
| 684 Send(new InputMsg_SetFocus(routing_id_, false)); | 692 Send(new InputMsg_SetFocus(routing_id_, false)); |
| 685 } | 693 } |
| 686 | 694 |
| 687 void RenderWidgetHostImpl::LostCapture() { | 695 void RenderWidgetHostImpl::LostCapture() { |
| 696 if (touch_emulator_) |
| 697 touch_emulator_->CancelTouch(); |
| 698 |
| 688 Send(new InputMsg_MouseCaptureLost(routing_id_)); | 699 Send(new InputMsg_MouseCaptureLost(routing_id_)); |
| 689 } | 700 } |
| 690 | 701 |
| 691 void RenderWidgetHostImpl::SetActive(bool active) { | 702 void RenderWidgetHostImpl::SetActive(bool active) { |
| 692 Send(new ViewMsg_SetActive(routing_id_, active)); | 703 Send(new ViewMsg_SetActive(routing_id_, active)); |
| 693 } | 704 } |
| 694 | 705 |
| 695 void RenderWidgetHostImpl::LostMouseLock() { | 706 void RenderWidgetHostImpl::LostMouseLock() { |
| 696 Send(new ViewMsg_MouseLockLost(routing_id_)); | 707 Send(new ViewMsg_MouseLockLost(routing_id_)); |
| 697 } | 708 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); | 995 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); |
| 985 | 996 |
| 986 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { | 997 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
| 987 if (mouse_event_callbacks_[i].Run(mouse_event)) | 998 if (mouse_event_callbacks_[i].Run(mouse_event)) |
| 988 return; | 999 return; |
| 989 } | 1000 } |
| 990 | 1001 |
| 991 if (IgnoreInputEvents()) | 1002 if (IgnoreInputEvents()) |
| 992 return; | 1003 return; |
| 993 | 1004 |
| 1005 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
| 1006 return; |
| 1007 |
| 994 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 1008 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
| 995 latency_info)); | 1009 latency_info)); |
| 996 } | 1010 } |
| 997 | 1011 |
| 998 void RenderWidgetHostImpl::OnPointerEventActivate() { | 1012 void RenderWidgetHostImpl::OnPointerEventActivate() { |
| 999 } | 1013 } |
| 1000 | 1014 |
| 1001 void RenderWidgetHostImpl::ForwardWheelEvent( | 1015 void RenderWidgetHostImpl::ForwardWheelEvent( |
| 1002 const WebMouseWheelEvent& wheel_event) { | 1016 const WebMouseWheelEvent& wheel_event) { |
| 1003 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 1017 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
| 1004 } | 1018 } |
| 1005 | 1019 |
| 1006 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 1020 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
| 1007 const blink::WebMouseWheelEvent& wheel_event, | 1021 const blink::WebMouseWheelEvent& wheel_event, |
| 1008 const ui::LatencyInfo& ui_latency) { | 1022 const ui::LatencyInfo& ui_latency) { |
| 1009 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 1023 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
| 1010 | 1024 |
| 1011 ui::LatencyInfo latency_info = | 1025 ui::LatencyInfo latency_info = |
| 1012 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); | 1026 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); |
| 1013 | 1027 |
| 1014 if (IgnoreInputEvents()) | 1028 if (IgnoreInputEvents()) |
| 1015 return; | 1029 return; |
| 1016 | 1030 |
| 1031 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
| 1032 return; |
| 1033 |
| 1017 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, | 1034 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, |
| 1018 latency_info)); | 1035 latency_info)); |
| 1019 } | 1036 } |
| 1020 | 1037 |
| 1021 void RenderWidgetHostImpl::ForwardGestureEvent( | 1038 void RenderWidgetHostImpl::ForwardGestureEvent( |
| 1022 const blink::WebGestureEvent& gesture_event) { | 1039 const blink::WebGestureEvent& gesture_event) { |
| 1023 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 1040 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
| 1024 } | 1041 } |
| 1025 | 1042 |
| 1026 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 1043 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1056 original_component.sequence_number, | 1073 original_component.sequence_number, |
| 1057 original_component.event_time, | 1074 original_component.event_time, |
| 1058 original_component.event_count); | 1075 original_component.event_count); |
| 1059 } | 1076 } |
| 1060 } | 1077 } |
| 1061 | 1078 |
| 1062 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); | 1079 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); |
| 1063 input_router_->SendGestureEvent(gesture_with_latency); | 1080 input_router_->SendGestureEvent(gesture_with_latency); |
| 1064 } | 1081 } |
| 1065 | 1082 |
| 1083 void RenderWidgetHostImpl::ForwardTouchEvent( |
| 1084 const blink::WebTouchEvent& touch_event) { |
| 1085 ForwardTouchEventWithLatencyInfo(touch_event, ui::LatencyInfo()); |
| 1086 } |
| 1087 |
| 1066 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1088 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
| 1067 const blink::WebTouchEvent& touch_event, | 1089 const blink::WebTouchEvent& touch_event, |
| 1068 const ui::LatencyInfo& ui_latency) { | 1090 const ui::LatencyInfo& ui_latency) { |
| 1069 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 1091 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
| 1070 | 1092 |
| 1071 // Always forward TouchEvents for touch stream consistency. They will be | 1093 // Always forward TouchEvents for touch stream consistency. They will be |
| 1072 // ignored if appropriate in FilterInputEvent(). | 1094 // ignored if appropriate in FilterInputEvent(). |
| 1073 | 1095 |
| 1074 ui::LatencyInfo latency_info = | 1096 ui::LatencyInfo latency_info = |
| 1075 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); | 1097 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 | 1153 |
| 1132 // Tab switching/closing accelerators aren't sent to the renderer to avoid | 1154 // Tab switching/closing accelerators aren't sent to the renderer to avoid |
| 1133 // a hung/malicious renderer from interfering. | 1155 // a hung/malicious renderer from interfering. |
| 1134 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) | 1156 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) |
| 1135 return; | 1157 return; |
| 1136 | 1158 |
| 1137 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1159 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
| 1138 suppress_next_char_events_ = false; | 1160 suppress_next_char_events_ = false; |
| 1139 } | 1161 } |
| 1140 | 1162 |
| 1163 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
| 1164 return; |
| 1165 |
| 1141 input_router_->SendKeyboardEvent( | 1166 input_router_->SendKeyboardEvent( |
| 1142 key_event, | 1167 key_event, |
| 1143 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), | 1168 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), |
| 1144 is_shortcut); | 1169 is_shortcut); |
| 1145 } | 1170 } |
| 1146 | 1171 |
| 1147 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1172 void RenderWidgetHostImpl::QueueSyntheticGesture( |
| 1148 scoped_ptr<SyntheticGesture> synthetic_gesture, | 1173 scoped_ptr<SyntheticGesture> synthetic_gesture, |
| 1149 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1174 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| 1150 if (!synthetic_gesture_controller_ && view_) { | 1175 if (!synthetic_gesture_controller_ && view_) { |
| 1151 synthetic_gesture_controller_.reset( | 1176 synthetic_gesture_controller_.reset( |
| 1152 new SyntheticGestureController( | 1177 new SyntheticGestureController( |
| 1153 view_->CreateSyntheticGestureTarget().Pass())); | 1178 view_->CreateSyntheticGestureTarget().Pass())); |
| 1154 } | 1179 } |
| 1155 if (synthetic_gesture_controller_) { | 1180 if (synthetic_gesture_controller_) { |
| 1156 synthetic_gesture_controller_->QueueSyntheticGesture( | 1181 synthetic_gesture_controller_->QueueSyntheticGesture( |
| 1157 synthetic_gesture.Pass(), on_complete); | 1182 synthetic_gesture.Pass(), on_complete); |
| 1158 } | 1183 } |
| 1159 } | 1184 } |
| 1160 | 1185 |
| 1186 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
| 1187 if (!view_) |
| 1188 return; |
| 1189 view_->UpdateCursor(cursor); |
| 1190 } |
| 1191 |
| 1161 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1192 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
| 1162 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1193 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
| 1163 } | 1194 } |
| 1164 | 1195 |
| 1165 int64 RenderWidgetHostImpl::GetLatencyComponentId() { | 1196 int64 RenderWidgetHostImpl::GetLatencyComponentId() { |
| 1166 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); | 1197 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); |
| 1167 } | 1198 } |
| 1168 | 1199 |
| 1169 // static | 1200 // static |
| 1170 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { | 1201 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 GetProcess()->ReceivedBadMessage(); | 1836 GetProcess()->ReceivedBadMessage(); |
| 1806 } | 1837 } |
| 1807 | 1838 |
| 1808 void RenderWidgetHostImpl::OnBlur() { | 1839 void RenderWidgetHostImpl::OnBlur() { |
| 1809 // Only RenderViewHost can deal with that message. | 1840 // Only RenderViewHost can deal with that message. |
| 1810 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); | 1841 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); |
| 1811 GetProcess()->ReceivedBadMessage(); | 1842 GetProcess()->ReceivedBadMessage(); |
| 1812 } | 1843 } |
| 1813 | 1844 |
| 1814 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { | 1845 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
| 1815 if (!view_) { | 1846 SetCursor(cursor); |
| 1816 return; | 1847 } |
| 1848 |
| 1849 void RenderWidgetHostImpl::OnSetTouchEventEmulationEnabled(bool enabled) { |
| 1850 if (enabled) { |
| 1851 if (!touch_emulator_) |
| 1852 touch_emulator_.reset(new TouchEmulator(this)); |
| 1853 } else { |
| 1854 touch_emulator_.reset(); |
| 1817 } | 1855 } |
| 1818 view_->UpdateCursor(cursor); | |
| 1819 } | 1856 } |
| 1820 | 1857 |
| 1821 void RenderWidgetHostImpl::OnTextInputTypeChanged( | 1858 void RenderWidgetHostImpl::OnTextInputTypeChanged( |
| 1822 ui::TextInputType type, | 1859 ui::TextInputType type, |
| 1823 ui::TextInputMode input_mode, | 1860 ui::TextInputMode input_mode, |
| 1824 bool can_compose_inline) { | 1861 bool can_compose_inline) { |
| 1825 if (view_) | 1862 if (view_) |
| 1826 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); | 1863 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); |
| 1827 } | 1864 } |
| 1828 | 1865 |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 TouchEventWithLatencyInfo touch_event = event; | 2180 TouchEventWithLatencyInfo touch_event = event; |
| 2144 touch_event.latency.AddLatencyNumber( | 2181 touch_event.latency.AddLatencyNumber( |
| 2145 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); | 2182 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); |
| 2146 // TouchEvent latency ends at ack if it didn't cause any rendering. | 2183 // TouchEvent latency ends at ack if it didn't cause any rendering. |
| 2147 if (!touch_event.latency.FindLatency( | 2184 if (!touch_event.latency.FindLatency( |
| 2148 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2185 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
| 2149 touch_event.latency.AddLatencyNumber( | 2186 touch_event.latency.AddLatencyNumber( |
| 2150 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | 2187 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| 2151 } | 2188 } |
| 2152 ComputeTouchLatency(touch_event.latency); | 2189 ComputeTouchLatency(touch_event.latency); |
| 2190 |
| 2191 if (touch_emulator_ && touch_emulator_->HandleTouchEventAck(ack_result)) |
| 2192 return; |
| 2193 |
| 2153 if (view_) | 2194 if (view_) |
| 2154 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 2195 view_->ProcessAckedTouchEvent(touch_event, ack_result); |
| 2155 } | 2196 } |
| 2156 | 2197 |
| 2157 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 2198 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
| 2158 if (type == BAD_ACK_MESSAGE) { | 2199 if (type == BAD_ACK_MESSAGE) { |
| 2159 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); | 2200 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); |
| 2160 process_->ReceivedBadMessage(); | 2201 process_->ReceivedBadMessage(); |
| 2161 } else if (type == UNEXPECTED_EVENT_TYPE) { | 2202 } else if (type == UNEXPECTED_EVENT_TYPE) { |
| 2162 suppress_next_char_events_ = false; | 2203 suppress_next_char_events_ = false; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2545 } | 2586 } |
| 2546 } | 2587 } |
| 2547 | 2588 |
| 2548 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2589 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2549 if (view_) | 2590 if (view_) |
| 2550 return view_->PreferredReadbackFormat(); | 2591 return view_->PreferredReadbackFormat(); |
| 2551 return SkBitmap::kARGB_8888_Config; | 2592 return SkBitmap::kARGB_8888_Config; |
| 2552 } | 2593 } |
| 2553 | 2594 |
| 2554 } // namespace content | 2595 } // namespace content |
| OLD | NEW |