| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // If we're initially visible, tell the process host that we're alive. | 233 // If we're initially visible, tell the process host that we're alive. |
| 233 // Otherwise we'll notify the process host when we are first shown. | 234 // Otherwise we'll notify the process host when we are first shown. |
| 234 if (!hidden) | 235 if (!hidden) |
| 235 process_->WidgetRestored(); | 236 process_->WidgetRestored(); |
| 236 | 237 |
| 237 accessibility_mode_ = | 238 accessibility_mode_ = |
| 238 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); | 239 BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode(); |
| 239 | 240 |
| 240 input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_)); | 241 input_router_.reset(new InputRouterImpl(process_, this, this, routing_id_)); |
| 241 | 242 |
| 243 touch_emulator_.reset(); |
| 244 |
| 242 #if defined(USE_AURA) | 245 #if defined(USE_AURA) |
| 243 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> | 246 bool overscroll_enabled = CommandLine::ForCurrentProcess()-> |
| 244 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; | 247 GetSwitchValueASCII(switches::kOverscrollHistoryNavigation) != "0"; |
| 245 SetOverscrollControllerEnabled(overscroll_enabled); | 248 SetOverscrollControllerEnabled(overscroll_enabled); |
| 246 #endif | 249 #endif |
| 247 | 250 |
| 248 if (GetProcess()->IsGuest() || !CommandLine::ForCurrentProcess()->HasSwitch( | 251 if (GetProcess()->IsGuest() || !CommandLine::ForCurrentProcess()->HasSwitch( |
| 249 switches::kDisableHangMonitor)) { | 252 switches::kDisableHangMonitor)) { |
| 250 hang_monitor_timeout_.reset(new TimeoutMonitor( | 253 hang_monitor_timeout_.reset(new TimeoutMonitor( |
| 251 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, | 254 base::Bind(&RenderWidgetHostImpl::RendererIsUnresponsive, |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) | 475 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnSetTooltipText) |
| 473 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, | 476 IPC_MESSAGE_HANDLER_GENERIC(ViewHostMsg_SwapCompositorFrame, |
| 474 msg_is_ok = OnSwapCompositorFrame(msg)) | 477 msg_is_ok = OnSwapCompositorFrame(msg)) |
| 475 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) | 478 IPC_MESSAGE_HANDLER(ViewHostMsg_DidOverscroll, OnOverscrolled) |
| 476 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) | 479 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopFlinging, OnFlingingStopped) |
| 477 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) | 480 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect) |
| 478 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) | 481 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnUpdateIsDelayed) |
| 479 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) | 482 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnFocus) |
| 480 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) | 483 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnBlur) |
| 481 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) | 484 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) |
| 485 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTouchEventEmulationEnabled, |
| 486 OnSetTouchEventEmulationEnabled) |
| 482 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, | 487 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputTypeChanged, |
| 483 OnTextInputTypeChanged) | 488 OnTextInputTypeChanged) |
| 484 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 489 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| 485 OnImeCancelComposition) | 490 OnImeCancelComposition) |
| 486 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, | 491 IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, |
| 487 OnDidActivateAcceleratedCompositing) | 492 OnDidActivateAcceleratedCompositing) |
| 488 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) | 493 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) |
| 489 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) | 494 IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnUnlockMouse) |
| 490 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, | 495 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, |
| 491 OnShowDisambiguationPopup) | 496 OnShowDisambiguationPopup) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 // If there is a pending mouse lock request, we don't want to reject it at | 675 // If there is a pending mouse lock request, we don't want to reject it at |
| 671 // this point. The user can switch focus back to this view and approve the | 676 // this point. The user can switch focus back to this view and approve the |
| 672 // request later. | 677 // request later. |
| 673 if (IsMouseLocked()) | 678 if (IsMouseLocked()) |
| 674 view_->UnlockMouse(); | 679 view_->UnlockMouse(); |
| 675 | 680 |
| 676 // If there is a pending overscroll, then that should be cancelled. | 681 // If there is a pending overscroll, then that should be cancelled. |
| 677 if (overscroll_controller_) | 682 if (overscroll_controller_) |
| 678 overscroll_controller_->Cancel(); | 683 overscroll_controller_->Cancel(); |
| 679 | 684 |
| 685 if (touch_emulator_) |
| 686 touch_emulator_->CancelTouch(); |
| 687 |
| 680 Send(new InputMsg_SetFocus(routing_id_, false)); | 688 Send(new InputMsg_SetFocus(routing_id_, false)); |
| 681 } | 689 } |
| 682 | 690 |
| 683 void RenderWidgetHostImpl::LostCapture() { | 691 void RenderWidgetHostImpl::LostCapture() { |
| 692 if (touch_emulator_) |
| 693 touch_emulator_->CancelTouch(); |
| 694 |
| 684 Send(new InputMsg_MouseCaptureLost(routing_id_)); | 695 Send(new InputMsg_MouseCaptureLost(routing_id_)); |
| 685 } | 696 } |
| 686 | 697 |
| 687 void RenderWidgetHostImpl::SetActive(bool active) { | 698 void RenderWidgetHostImpl::SetActive(bool active) { |
| 688 Send(new ViewMsg_SetActive(routing_id_, active)); | 699 Send(new ViewMsg_SetActive(routing_id_, active)); |
| 689 } | 700 } |
| 690 | 701 |
| 691 void RenderWidgetHostImpl::LostMouseLock() { | 702 void RenderWidgetHostImpl::LostMouseLock() { |
| 692 Send(new ViewMsg_MouseLockLost(routing_id_)); | 703 Send(new ViewMsg_MouseLockLost(routing_id_)); |
| 693 } | 704 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); | 988 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); |
| 978 | 989 |
| 979 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { | 990 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
| 980 if (mouse_event_callbacks_[i].Run(mouse_event)) | 991 if (mouse_event_callbacks_[i].Run(mouse_event)) |
| 981 return; | 992 return; |
| 982 } | 993 } |
| 983 | 994 |
| 984 if (IgnoreInputEvents()) | 995 if (IgnoreInputEvents()) |
| 985 return; | 996 return; |
| 986 | 997 |
| 998 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
| 999 return; |
| 1000 |
| 987 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 1001 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
| 988 latency_info)); | 1002 latency_info)); |
| 989 } | 1003 } |
| 990 | 1004 |
| 991 void RenderWidgetHostImpl::OnPointerEventActivate() { | 1005 void RenderWidgetHostImpl::OnPointerEventActivate() { |
| 992 } | 1006 } |
| 993 | 1007 |
| 994 void RenderWidgetHostImpl::ForwardWheelEvent( | 1008 void RenderWidgetHostImpl::ForwardWheelEvent( |
| 995 const WebMouseWheelEvent& wheel_event) { | 1009 const WebMouseWheelEvent& wheel_event) { |
| 996 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 1010 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
| 997 } | 1011 } |
| 998 | 1012 |
| 999 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 1013 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
| 1000 const blink::WebMouseWheelEvent& wheel_event, | 1014 const blink::WebMouseWheelEvent& wheel_event, |
| 1001 const ui::LatencyInfo& ui_latency) { | 1015 const ui::LatencyInfo& ui_latency) { |
| 1002 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 1016 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
| 1003 | 1017 |
| 1004 ui::LatencyInfo latency_info = | 1018 ui::LatencyInfo latency_info = |
| 1005 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); | 1019 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); |
| 1006 | 1020 |
| 1007 if (IgnoreInputEvents()) | 1021 if (IgnoreInputEvents()) |
| 1008 return; | 1022 return; |
| 1009 | 1023 |
| 1024 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
| 1025 return; |
| 1026 |
| 1010 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, | 1027 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, |
| 1011 latency_info)); | 1028 latency_info)); |
| 1012 } | 1029 } |
| 1013 | 1030 |
| 1014 void RenderWidgetHostImpl::ForwardGestureEvent( | 1031 void RenderWidgetHostImpl::ForwardGestureEvent( |
| 1015 const blink::WebGestureEvent& gesture_event) { | 1032 const blink::WebGestureEvent& gesture_event) { |
| 1016 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 1033 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
| 1017 } | 1034 } |
| 1018 | 1035 |
| 1019 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 1036 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1049 original_component.sequence_number, | 1066 original_component.sequence_number, |
| 1050 original_component.event_time, | 1067 original_component.event_time, |
| 1051 original_component.event_count); | 1068 original_component.event_count); |
| 1052 } | 1069 } |
| 1053 } | 1070 } |
| 1054 | 1071 |
| 1055 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); | 1072 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); |
| 1056 input_router_->SendGestureEvent(gesture_with_latency); | 1073 input_router_->SendGestureEvent(gesture_with_latency); |
| 1057 } | 1074 } |
| 1058 | 1075 |
| 1076 void RenderWidgetHostImpl::ForwardTouchEvent( |
| 1077 const blink::WebTouchEvent& touch_event) { |
| 1078 ForwardTouchEventWithLatencyInfo(touch_event, ui::LatencyInfo()); |
| 1079 } |
| 1080 |
| 1059 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1081 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
| 1060 const blink::WebTouchEvent& touch_event, | 1082 const blink::WebTouchEvent& touch_event, |
| 1061 const ui::LatencyInfo& ui_latency) { | 1083 const ui::LatencyInfo& ui_latency) { |
| 1062 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 1084 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
| 1063 | 1085 |
| 1064 // Always forward TouchEvents for touch stream consistency. They will be | 1086 // Always forward TouchEvents for touch stream consistency. They will be |
| 1065 // ignored if appropriate in FilterInputEvent(). | 1087 // ignored if appropriate in FilterInputEvent(). |
| 1066 | 1088 |
| 1067 ui::LatencyInfo latency_info = | 1089 ui::LatencyInfo latency_info = |
| 1068 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); | 1090 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 | 1146 |
| 1125 // Tab switching/closing accelerators aren't sent to the renderer to avoid | 1147 // Tab switching/closing accelerators aren't sent to the renderer to avoid |
| 1126 // a hung/malicious renderer from interfering. | 1148 // a hung/malicious renderer from interfering. |
| 1127 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) | 1149 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) |
| 1128 return; | 1150 return; |
| 1129 | 1151 |
| 1130 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1152 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
| 1131 suppress_next_char_events_ = false; | 1153 suppress_next_char_events_ = false; |
| 1132 } | 1154 } |
| 1133 | 1155 |
| 1156 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
| 1157 return; |
| 1158 |
| 1134 input_router_->SendKeyboardEvent( | 1159 input_router_->SendKeyboardEvent( |
| 1135 key_event, | 1160 key_event, |
| 1136 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), | 1161 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), |
| 1137 is_shortcut); | 1162 is_shortcut); |
| 1138 } | 1163 } |
| 1139 | 1164 |
| 1140 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1165 void RenderWidgetHostImpl::QueueSyntheticGesture( |
| 1141 scoped_ptr<SyntheticGesture> synthetic_gesture, | 1166 scoped_ptr<SyntheticGesture> synthetic_gesture, |
| 1142 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1167 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| 1143 if (!synthetic_gesture_controller_ && view_) { | 1168 if (!synthetic_gesture_controller_ && view_) { |
| 1144 synthetic_gesture_controller_.reset( | 1169 synthetic_gesture_controller_.reset( |
| 1145 new SyntheticGestureController( | 1170 new SyntheticGestureController( |
| 1146 view_->CreateSyntheticGestureTarget().Pass())); | 1171 view_->CreateSyntheticGestureTarget().Pass())); |
| 1147 } | 1172 } |
| 1148 if (synthetic_gesture_controller_) { | 1173 if (synthetic_gesture_controller_) { |
| 1149 synthetic_gesture_controller_->QueueSyntheticGesture( | 1174 synthetic_gesture_controller_->QueueSyntheticGesture( |
| 1150 synthetic_gesture.Pass(), on_complete); | 1175 synthetic_gesture.Pass(), on_complete); |
| 1151 } | 1176 } |
| 1152 } | 1177 } |
| 1153 | 1178 |
| 1179 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
| 1180 if (!view_) |
| 1181 return; |
| 1182 view_->UpdateCursor(cursor); |
| 1183 } |
| 1184 |
| 1154 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1185 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
| 1155 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1186 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
| 1156 } | 1187 } |
| 1157 | 1188 |
| 1158 int64 RenderWidgetHostImpl::GetLatencyComponentId() { | 1189 int64 RenderWidgetHostImpl::GetLatencyComponentId() { |
| 1159 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); | 1190 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); |
| 1160 } | 1191 } |
| 1161 | 1192 |
| 1162 // static | 1193 // static |
| 1163 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { | 1194 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1808 GetProcess()->ReceivedBadMessage(); | 1839 GetProcess()->ReceivedBadMessage(); |
| 1809 } | 1840 } |
| 1810 | 1841 |
| 1811 void RenderWidgetHostImpl::OnBlur() { | 1842 void RenderWidgetHostImpl::OnBlur() { |
| 1812 // Only RenderViewHost can deal with that message. | 1843 // Only RenderViewHost can deal with that message. |
| 1813 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); | 1844 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); |
| 1814 GetProcess()->ReceivedBadMessage(); | 1845 GetProcess()->ReceivedBadMessage(); |
| 1815 } | 1846 } |
| 1816 | 1847 |
| 1817 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { | 1848 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
| 1818 if (!view_) { | 1849 SetCursor(cursor); |
| 1819 return; | 1850 } |
| 1851 |
| 1852 void RenderWidgetHostImpl::OnSetTouchEventEmulationEnabled( |
| 1853 bool enabled, bool allow_pinch) { |
| 1854 if (enabled) { |
| 1855 if (!touch_emulator_) |
| 1856 touch_emulator_.reset(new TouchEmulator(this)); |
| 1857 touch_emulator_->Enable(allow_pinch); |
| 1858 } else { |
| 1859 if (touch_emulator_) |
| 1860 touch_emulator_->Disable(); |
| 1820 } | 1861 } |
| 1821 view_->UpdateCursor(cursor); | |
| 1822 } | 1862 } |
| 1823 | 1863 |
| 1824 void RenderWidgetHostImpl::OnTextInputTypeChanged( | 1864 void RenderWidgetHostImpl::OnTextInputTypeChanged( |
| 1825 ui::TextInputType type, | 1865 ui::TextInputType type, |
| 1826 ui::TextInputMode input_mode, | 1866 ui::TextInputMode input_mode, |
| 1827 bool can_compose_inline) { | 1867 bool can_compose_inline) { |
| 1828 if (view_) | 1868 if (view_) |
| 1829 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); | 1869 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); |
| 1830 } | 1870 } |
| 1831 | 1871 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2149 TouchEventWithLatencyInfo touch_event = event; | 2189 TouchEventWithLatencyInfo touch_event = event; |
| 2150 touch_event.latency.AddLatencyNumber( | 2190 touch_event.latency.AddLatencyNumber( |
| 2151 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); | 2191 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); |
| 2152 // TouchEvent latency ends at ack if it didn't cause any rendering. | 2192 // TouchEvent latency ends at ack if it didn't cause any rendering. |
| 2153 if (!touch_event.latency.FindLatency( | 2193 if (!touch_event.latency.FindLatency( |
| 2154 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2194 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
| 2155 touch_event.latency.AddLatencyNumber( | 2195 touch_event.latency.AddLatencyNumber( |
| 2156 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | 2196 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| 2157 } | 2197 } |
| 2158 ComputeTouchLatency(touch_event.latency); | 2198 ComputeTouchLatency(touch_event.latency); |
| 2199 |
| 2200 if (touch_emulator_ && touch_emulator_->HandleTouchEventAck(ack_result)) |
| 2201 return; |
| 2202 |
| 2159 if (view_) | 2203 if (view_) |
| 2160 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 2204 view_->ProcessAckedTouchEvent(touch_event, ack_result); |
| 2161 } | 2205 } |
| 2162 | 2206 |
| 2163 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 2207 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
| 2164 if (type == BAD_ACK_MESSAGE) { | 2208 if (type == BAD_ACK_MESSAGE) { |
| 2165 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); | 2209 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); |
| 2166 process_->ReceivedBadMessage(); | 2210 process_->ReceivedBadMessage(); |
| 2167 } else if (type == UNEXPECTED_EVENT_TYPE) { | 2211 } else if (type == UNEXPECTED_EVENT_TYPE) { |
| 2168 suppress_next_char_events_ = false; | 2212 suppress_next_char_events_ = false; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 } | 2590 } |
| 2547 } | 2591 } |
| 2548 | 2592 |
| 2549 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2593 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2550 if (view_) | 2594 if (view_) |
| 2551 return view_->PreferredReadbackFormat(); | 2595 return view_->PreferredReadbackFormat(); |
| 2552 return SkBitmap::kARGB_8888_Config; | 2596 return SkBitmap::kARGB_8888_Config; |
| 2553 } | 2597 } |
| 2554 | 2598 |
| 2555 } // namespace content | 2599 } // namespace content |
| OLD | NEW |