| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); | 1002 CreateRWHLatencyInfoIfNotExist(&ui_latency, mouse_event.type); |
| 992 | 1003 |
| 993 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { | 1004 for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { |
| 994 if (mouse_event_callbacks_[i].Run(mouse_event)) | 1005 if (mouse_event_callbacks_[i].Run(mouse_event)) |
| 995 return; | 1006 return; |
| 996 } | 1007 } |
| 997 | 1008 |
| 998 if (IgnoreInputEvents()) | 1009 if (IgnoreInputEvents()) |
| 999 return; | 1010 return; |
| 1000 | 1011 |
| 1012 if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) |
| 1013 return; |
| 1014 |
| 1001 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, | 1015 input_router_->SendMouseEvent(MouseEventWithLatencyInfo(mouse_event, |
| 1002 latency_info)); | 1016 latency_info)); |
| 1003 } | 1017 } |
| 1004 | 1018 |
| 1005 void RenderWidgetHostImpl::OnPointerEventActivate() { | 1019 void RenderWidgetHostImpl::OnPointerEventActivate() { |
| 1006 } | 1020 } |
| 1007 | 1021 |
| 1008 void RenderWidgetHostImpl::ForwardWheelEvent( | 1022 void RenderWidgetHostImpl::ForwardWheelEvent( |
| 1009 const WebMouseWheelEvent& wheel_event) { | 1023 const WebMouseWheelEvent& wheel_event) { |
| 1010 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); | 1024 ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo()); |
| 1011 } | 1025 } |
| 1012 | 1026 |
| 1013 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( | 1027 void RenderWidgetHostImpl::ForwardWheelEventWithLatencyInfo( |
| 1014 const blink::WebMouseWheelEvent& wheel_event, | 1028 const blink::WebMouseWheelEvent& wheel_event, |
| 1015 const ui::LatencyInfo& ui_latency) { | 1029 const ui::LatencyInfo& ui_latency) { |
| 1016 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); | 1030 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardWheelEvent"); |
| 1017 | 1031 |
| 1018 ui::LatencyInfo latency_info = | 1032 ui::LatencyInfo latency_info = |
| 1019 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); | 1033 CreateRWHLatencyInfoIfNotExist(&ui_latency, wheel_event.type); |
| 1020 | 1034 |
| 1021 if (IgnoreInputEvents()) | 1035 if (IgnoreInputEvents()) |
| 1022 return; | 1036 return; |
| 1023 | 1037 |
| 1038 if (touch_emulator_ && touch_emulator_->HandleMouseWheelEvent(wheel_event)) |
| 1039 return; |
| 1040 |
| 1024 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, | 1041 input_router_->SendWheelEvent(MouseWheelEventWithLatencyInfo(wheel_event, |
| 1025 latency_info)); | 1042 latency_info)); |
| 1026 } | 1043 } |
| 1027 | 1044 |
| 1028 void RenderWidgetHostImpl::ForwardGestureEvent( | 1045 void RenderWidgetHostImpl::ForwardGestureEvent( |
| 1029 const blink::WebGestureEvent& gesture_event) { | 1046 const blink::WebGestureEvent& gesture_event) { |
| 1030 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); | 1047 ForwardGestureEventWithLatencyInfo(gesture_event, ui::LatencyInfo()); |
| 1031 } | 1048 } |
| 1032 | 1049 |
| 1033 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( | 1050 void RenderWidgetHostImpl::ForwardGestureEventWithLatencyInfo( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1063 original_component.sequence_number, | 1080 original_component.sequence_number, |
| 1064 original_component.event_time, | 1081 original_component.event_time, |
| 1065 original_component.event_count); | 1082 original_component.event_count); |
| 1066 } | 1083 } |
| 1067 } | 1084 } |
| 1068 | 1085 |
| 1069 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); | 1086 GestureEventWithLatencyInfo gesture_with_latency(gesture_event, latency_info); |
| 1070 input_router_->SendGestureEvent(gesture_with_latency); | 1087 input_router_->SendGestureEvent(gesture_with_latency); |
| 1071 } | 1088 } |
| 1072 | 1089 |
| 1090 void RenderWidgetHostImpl::ForwardTouchEvent( |
| 1091 const blink::WebTouchEvent& touch_event) { |
| 1092 ForwardTouchEventWithLatencyInfo(touch_event, ui::LatencyInfo()); |
| 1093 } |
| 1094 |
| 1073 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( | 1095 void RenderWidgetHostImpl::ForwardTouchEventWithLatencyInfo( |
| 1074 const blink::WebTouchEvent& touch_event, | 1096 const blink::WebTouchEvent& touch_event, |
| 1075 const ui::LatencyInfo& ui_latency) { | 1097 const ui::LatencyInfo& ui_latency) { |
| 1076 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); | 1098 TRACE_EVENT0("input", "RenderWidgetHostImpl::ForwardTouchEvent"); |
| 1077 | 1099 |
| 1078 // Always forward TouchEvents for touch stream consistency. They will be | 1100 // Always forward TouchEvents for touch stream consistency. They will be |
| 1079 // ignored if appropriate in FilterInputEvent(). | 1101 // ignored if appropriate in FilterInputEvent(). |
| 1080 | 1102 |
| 1081 ui::LatencyInfo latency_info = | 1103 ui::LatencyInfo latency_info = |
| 1082 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); | 1104 CreateRWHLatencyInfoIfNotExist(&ui_latency, touch_event.type); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 | 1160 |
| 1139 // Tab switching/closing accelerators aren't sent to the renderer to avoid | 1161 // Tab switching/closing accelerators aren't sent to the renderer to avoid |
| 1140 // a hung/malicious renderer from interfering. | 1162 // a hung/malicious renderer from interfering. |
| 1141 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) | 1163 if (delegate_->PreHandleKeyboardEvent(key_event, &is_shortcut)) |
| 1142 return; | 1164 return; |
| 1143 | 1165 |
| 1144 if (key_event.type == WebKeyboardEvent::RawKeyDown) | 1166 if (key_event.type == WebKeyboardEvent::RawKeyDown) |
| 1145 suppress_next_char_events_ = false; | 1167 suppress_next_char_events_ = false; |
| 1146 } | 1168 } |
| 1147 | 1169 |
| 1170 if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) |
| 1171 return; |
| 1172 |
| 1148 input_router_->SendKeyboardEvent( | 1173 input_router_->SendKeyboardEvent( |
| 1149 key_event, | 1174 key_event, |
| 1150 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), | 1175 CreateRWHLatencyInfoIfNotExist(NULL, key_event.type), |
| 1151 is_shortcut); | 1176 is_shortcut); |
| 1152 } | 1177 } |
| 1153 | 1178 |
| 1154 void RenderWidgetHostImpl::QueueSyntheticGesture( | 1179 void RenderWidgetHostImpl::QueueSyntheticGesture( |
| 1155 scoped_ptr<SyntheticGesture> synthetic_gesture, | 1180 scoped_ptr<SyntheticGesture> synthetic_gesture, |
| 1156 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { | 1181 const base::Callback<void(SyntheticGesture::Result)>& on_complete) { |
| 1157 if (!synthetic_gesture_controller_ && view_) { | 1182 if (!synthetic_gesture_controller_ && view_) { |
| 1158 synthetic_gesture_controller_.reset( | 1183 synthetic_gesture_controller_.reset( |
| 1159 new SyntheticGestureController( | 1184 new SyntheticGestureController( |
| 1160 view_->CreateSyntheticGestureTarget().Pass())); | 1185 view_->CreateSyntheticGestureTarget().Pass())); |
| 1161 } | 1186 } |
| 1162 if (synthetic_gesture_controller_) { | 1187 if (synthetic_gesture_controller_) { |
| 1163 synthetic_gesture_controller_->QueueSyntheticGesture( | 1188 synthetic_gesture_controller_->QueueSyntheticGesture( |
| 1164 synthetic_gesture.Pass(), on_complete); | 1189 synthetic_gesture.Pass(), on_complete); |
| 1165 } | 1190 } |
| 1166 } | 1191 } |
| 1167 | 1192 |
| 1193 void RenderWidgetHostImpl::SetCursor(const WebCursor& cursor) { |
| 1194 if (!view_) |
| 1195 return; |
| 1196 view_->UpdateCursor(cursor); |
| 1197 } |
| 1198 |
| 1168 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { | 1199 void RenderWidgetHostImpl::SendCursorVisibilityState(bool is_visible) { |
| 1169 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); | 1200 Send(new InputMsg_CursorVisibilityChange(GetRoutingID(), is_visible)); |
| 1170 } | 1201 } |
| 1171 | 1202 |
| 1172 int64 RenderWidgetHostImpl::GetLatencyComponentId() { | 1203 int64 RenderWidgetHostImpl::GetLatencyComponentId() { |
| 1173 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); | 1204 return GetRoutingID() | (static_cast<int64>(GetProcess()->GetID()) << 32); |
| 1174 } | 1205 } |
| 1175 | 1206 |
| 1176 // static | 1207 // static |
| 1177 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { | 1208 void RenderWidgetHostImpl::DisableResizeAckCheckForTesting() { |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 GetProcess()->ReceivedBadMessage(); | 1853 GetProcess()->ReceivedBadMessage(); |
| 1823 } | 1854 } |
| 1824 | 1855 |
| 1825 void RenderWidgetHostImpl::OnBlur() { | 1856 void RenderWidgetHostImpl::OnBlur() { |
| 1826 // Only RenderViewHost can deal with that message. | 1857 // Only RenderViewHost can deal with that message. |
| 1827 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); | 1858 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH5")); |
| 1828 GetProcess()->ReceivedBadMessage(); | 1859 GetProcess()->ReceivedBadMessage(); |
| 1829 } | 1860 } |
| 1830 | 1861 |
| 1831 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { | 1862 void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) { |
| 1832 if (!view_) { | 1863 SetCursor(cursor); |
| 1833 return; | 1864 } |
| 1865 |
| 1866 void RenderWidgetHostImpl::OnSetTouchEventEmulationEnabled( |
| 1867 bool enabled, bool allow_pinch) { |
| 1868 if (enabled) { |
| 1869 if (!touch_emulator_) |
| 1870 touch_emulator_.reset(new TouchEmulator(this)); |
| 1871 touch_emulator_->Enable(allow_pinch); |
| 1872 } else { |
| 1873 if (touch_emulator_) |
| 1874 touch_emulator_->Disable(); |
| 1834 } | 1875 } |
| 1835 view_->UpdateCursor(cursor); | |
| 1836 } | 1876 } |
| 1837 | 1877 |
| 1838 void RenderWidgetHostImpl::OnTextInputTypeChanged( | 1878 void RenderWidgetHostImpl::OnTextInputTypeChanged( |
| 1839 ui::TextInputType type, | 1879 ui::TextInputType type, |
| 1840 ui::TextInputMode input_mode, | 1880 ui::TextInputMode input_mode, |
| 1841 bool can_compose_inline) { | 1881 bool can_compose_inline) { |
| 1842 if (view_) | 1882 if (view_) |
| 1843 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); | 1883 view_->TextInputTypeChanged(type, input_mode, can_compose_inline); |
| 1844 } | 1884 } |
| 1845 | 1885 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 TouchEventWithLatencyInfo touch_event = event; | 2203 TouchEventWithLatencyInfo touch_event = event; |
| 2164 touch_event.latency.AddLatencyNumber( | 2204 touch_event.latency.AddLatencyNumber( |
| 2165 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); | 2205 ui::INPUT_EVENT_LATENCY_ACKED_TOUCH_COMPONENT, 0, 0); |
| 2166 // TouchEvent latency ends at ack if it didn't cause any rendering. | 2206 // TouchEvent latency ends at ack if it didn't cause any rendering. |
| 2167 if (!touch_event.latency.FindLatency( | 2207 if (!touch_event.latency.FindLatency( |
| 2168 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { | 2208 ui::INPUT_EVENT_LATENCY_RENDERING_SCHEDULED_COMPONENT, 0, NULL)) { |
| 2169 touch_event.latency.AddLatencyNumber( | 2209 touch_event.latency.AddLatencyNumber( |
| 2170 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); | 2210 ui::INPUT_EVENT_LATENCY_TERMINATED_TOUCH_COMPONENT, 0, 0); |
| 2171 } | 2211 } |
| 2172 ComputeTouchLatency(touch_event.latency); | 2212 ComputeTouchLatency(touch_event.latency); |
| 2213 |
| 2214 if (touch_emulator_ && touch_emulator_->HandleTouchEventAck(ack_result)) |
| 2215 return; |
| 2216 |
| 2173 if (view_) | 2217 if (view_) |
| 2174 view_->ProcessAckedTouchEvent(touch_event, ack_result); | 2218 view_->ProcessAckedTouchEvent(touch_event, ack_result); |
| 2175 } | 2219 } |
| 2176 | 2220 |
| 2177 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { | 2221 void RenderWidgetHostImpl::OnUnexpectedEventAck(UnexpectedEventAckType type) { |
| 2178 if (type == BAD_ACK_MESSAGE) { | 2222 if (type == BAD_ACK_MESSAGE) { |
| 2179 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); | 2223 RecordAction(base::UserMetricsAction("BadMessageTerminate_RWH2")); |
| 2180 process_->ReceivedBadMessage(); | 2224 process_->ReceivedBadMessage(); |
| 2181 } else if (type == UNEXPECTED_EVENT_TYPE) { | 2225 } else if (type == UNEXPECTED_EVENT_TYPE) { |
| 2182 suppress_next_char_events_ = false; | 2226 suppress_next_char_events_ = false; |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 } | 2609 } |
| 2566 } | 2610 } |
| 2567 | 2611 |
| 2568 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { | 2612 SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { |
| 2569 if (view_) | 2613 if (view_) |
| 2570 return view_->PreferredReadbackFormat(); | 2614 return view_->PreferredReadbackFormat(); |
| 2571 return SkBitmap::kARGB_8888_Config; | 2615 return SkBitmap::kARGB_8888_Config; |
| 2572 } | 2616 } |
| 2573 | 2617 |
| 2574 } // namespace content | 2618 } // namespace content |
| OLD | NEW |