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