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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, | 315 IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, |
316 OnAllocateFakePluginWindowHandle) | 316 OnAllocateFakePluginWindowHandle) |
317 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, | 317 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, |
318 OnDestroyFakePluginWindowHandle) | 318 OnDestroyFakePluginWindowHandle) |
319 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface, | 319 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface, |
320 OnAcceleratedSurfaceSetIOSurface) | 320 OnAcceleratedSurfaceSetIOSurface) |
321 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, | 321 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, |
322 OnAcceleratedSurfaceSetTransportDIB) | 322 OnAcceleratedSurfaceSetTransportDIB) |
323 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, | 323 IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, |
324 OnAcceleratedSurfaceBuffersSwapped) | 324 OnAcceleratedSurfaceBuffersSwapped) |
| 325 IPC_MESSAGE_HANDLER(ViewHostMsg_SpeakText, OnMsgSpeakText) |
325 #endif | 326 #endif |
326 #if defined(TOOLKIT_GTK) | 327 #if defined(TOOLKIT_GTK) |
327 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, | 328 IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, |
328 OnMsgCreatePluginContainer) | 329 OnMsgCreatePluginContainer) |
329 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, | 330 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
330 OnMsgDestroyPluginContainer) | 331 OnMsgDestroyPluginContainer) |
331 #endif | 332 #endif |
332 IPC_MESSAGE_UNHANDLED(handled = false) | 333 IPC_MESSAGE_UNHANDLED(handled = false) |
333 IPC_END_MESSAGE_MAP_EX() | 334 IPC_END_MESSAGE_MAP_EX() |
334 | 335 |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), false); | 831 ForwardInputEvent(wheel_event, sizeof(WebMouseWheelEvent), false); |
831 } | 832 } |
832 | 833 |
833 void RenderWidgetHostImpl::ForwardGestureEvent( | 834 void RenderWidgetHostImpl::ForwardGestureEvent( |
834 const WebKit::WebGestureEvent& gesture_event) { | 835 const WebKit::WebGestureEvent& gesture_event) { |
835 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardGestureEvent"); | 836 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::ForwardGestureEvent"); |
836 if (ignore_input_events_ || process_->IgnoreInputEvents()) | 837 if (ignore_input_events_ || process_->IgnoreInputEvents()) |
837 return; | 838 return; |
838 | 839 |
839 if (gesture_event_pending_) { | 840 if (gesture_event_pending_) { |
840 if (coalesced_gesture_events_.empty() || | 841 if (coalesced_gesture_events_.empty() || |
841 !ShouldCoalesceGestureEvents(coalesced_gesture_events_.back(), | 842 !ShouldCoalesceGestureEvents(coalesced_gesture_events_.back(), |
842 gesture_event)) { | 843 gesture_event)) { |
843 coalesced_gesture_events_.push_back(gesture_event); | 844 coalesced_gesture_events_.push_back(gesture_event); |
844 } else { | 845 } else { |
845 WebGestureEvent* last_gesture_event = | 846 WebGestureEvent* last_gesture_event = |
846 &coalesced_gesture_events_.back(); | 847 &coalesced_gesture_events_.back(); |
847 last_gesture_event->deltaX += gesture_event.deltaX; | 848 last_gesture_event->deltaX += gesture_event.deltaX; |
848 last_gesture_event->deltaY += gesture_event.deltaY; | 849 last_gesture_event->deltaY += gesture_event.deltaY; |
849 DCHECK_GE(gesture_event.timeStampSeconds, | 850 DCHECK_GE(gesture_event.timeStampSeconds, |
850 last_gesture_event->timeStampSeconds); | 851 last_gesture_event->timeStampSeconds); |
851 last_gesture_event->timeStampSeconds = gesture_event.timeStampSeconds; | 852 last_gesture_event->timeStampSeconds = gesture_event.timeStampSeconds; |
852 } | 853 } |
853 return; | 854 return; |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { | 1223 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { |
1223 // Force the tooltip to have LTR directionality. | 1224 // Force the tooltip to have LTR directionality. |
1224 wrapped_tooltip_text = | 1225 wrapped_tooltip_text = |
1225 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); | 1226 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); |
1226 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && | 1227 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && |
1227 !base::i18n::IsRTL()) { | 1228 !base::i18n::IsRTL()) { |
1228 // Force the tooltip to have RTL directionality. | 1229 // Force the tooltip to have RTL directionality. |
1229 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); | 1230 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); |
1230 } | 1231 } |
1231 } | 1232 } |
1232 if (GetView()) | 1233 if (view_) |
1233 view_->SetTooltipText(wrapped_tooltip_text); | 1234 view_->SetTooltipText(wrapped_tooltip_text); |
1234 } | 1235 } |
1235 | 1236 |
1236 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { | 1237 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { |
1237 // Note that we ignore the position. | 1238 // Note that we ignore the position. |
1238 if (view_) { | 1239 if (view_) { |
1239 view_->SetBounds(pos); | 1240 view_->SetBounds(pos); |
1240 Send(new ViewMsg_Move_ACK(routing_id_)); | 1241 Send(new ViewMsg_Move_ACK(routing_id_)); |
1241 } | 1242 } |
1242 } | 1243 } |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", | 1604 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", |
1604 "activated", activated); | 1605 "activated", activated); |
1605 is_accelerated_compositing_active_ = activated; | 1606 is_accelerated_compositing_active_ = activated; |
1606 if (view_) | 1607 if (view_) |
1607 view_->OnAcceleratedCompositingStateChange(); | 1608 view_->OnAcceleratedCompositingStateChange(); |
1608 } | 1609 } |
1609 | 1610 |
1610 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture, | 1611 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture, |
1611 bool last_unlocked_by_target, | 1612 bool last_unlocked_by_target, |
1612 bool privileged) { | 1613 bool privileged) { |
1613 | |
1614 if (pending_mouse_lock_request_) { | 1614 if (pending_mouse_lock_request_) { |
1615 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); | 1615 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); |
1616 return; | 1616 return; |
1617 } else if (IsMouseLocked()) { | 1617 } else if (IsMouseLocked()) { |
1618 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); | 1618 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); |
1619 return; | 1619 return; |
1620 } | 1620 } |
1621 | 1621 |
1622 pending_mouse_lock_request_ = true; | 1622 pending_mouse_lock_request_ = true; |
1623 if (privileged && allow_privileged_mouse_lock_) { | 1623 if (privileged && allow_privileged_mouse_lock_) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 | 1865 |
1866 void RenderWidgetHostImpl::Delete() { | 1866 void RenderWidgetHostImpl::Delete() { |
1867 Send(new ViewMsg_Delete(GetRoutingID())); | 1867 Send(new ViewMsg_Delete(GetRoutingID())); |
1868 RecordAction(UserMetricsAction("DeleteSelection")); | 1868 RecordAction(UserMetricsAction("DeleteSelection")); |
1869 } | 1869 } |
1870 | 1870 |
1871 void RenderWidgetHostImpl::SelectAll() { | 1871 void RenderWidgetHostImpl::SelectAll() { |
1872 Send(new ViewMsg_SelectAll(GetRoutingID())); | 1872 Send(new ViewMsg_SelectAll(GetRoutingID())); |
1873 RecordAction(UserMetricsAction("SelectAll")); | 1873 RecordAction(UserMetricsAction("SelectAll")); |
1874 } | 1874 } |
| 1875 |
| 1876 void RenderWidgetHostImpl::SpeakSelection() { |
| 1877 #if defined(OS_MACOSX) |
| 1878 Send(new ViewMsg_SpeakSelection(GetRoutingID())); |
| 1879 RecordAction(UserMetricsAction("SpeakSelection")); |
| 1880 #endif |
| 1881 } |
| 1882 |
1875 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) { | 1883 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) { |
1876 if (!allowed) { | 1884 if (!allowed) { |
1877 RejectMouseLockOrUnlockIfNecessary(); | 1885 RejectMouseLockOrUnlockIfNecessary(); |
1878 return false; | 1886 return false; |
1879 } else { | 1887 } else { |
1880 if (!pending_mouse_lock_request_) { | 1888 if (!pending_mouse_lock_request_) { |
1881 // This is possible, e.g., the plugin sends us an unlock request before | 1889 // This is possible, e.g., the plugin sends us an unlock request before |
1882 // the user allows to lock to mouse. | 1890 // the user allows to lock to mouse. |
1883 return false; | 1891 return false; |
1884 } | 1892 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 // indicate that no callback is in progress (i.e. without this line | 1933 // indicate that no callback is in progress (i.e. without this line |
1926 // DelayedAutoResized will not get called again). | 1934 // DelayedAutoResized will not get called again). |
1927 new_auto_size_.SetSize(0, 0); | 1935 new_auto_size_.SetSize(0, 0); |
1928 if (!should_auto_resize_) | 1936 if (!should_auto_resize_) |
1929 return; | 1937 return; |
1930 | 1938 |
1931 OnRenderAutoResized(new_size); | 1939 OnRenderAutoResized(new_size); |
1932 } | 1940 } |
1933 | 1941 |
1934 } // namespace content | 1942 } // namespace content |
OLD | NEW |