Chromium Code Reviews| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 is_loading_(false), | 128 is_loading_(false), |
| 129 is_hidden_(false), | 129 is_hidden_(false), |
| 130 is_fullscreen_(false), | 130 is_fullscreen_(false), |
| 131 is_accelerated_compositing_active_(false), | 131 is_accelerated_compositing_active_(false), |
| 132 repaint_ack_pending_(false), | 132 repaint_ack_pending_(false), |
| 133 resize_ack_pending_(false), | 133 resize_ack_pending_(false), |
| 134 should_auto_resize_(false), | 134 should_auto_resize_(false), |
| 135 mouse_move_pending_(false), | 135 mouse_move_pending_(false), |
| 136 mouse_wheel_pending_(false), | 136 mouse_wheel_pending_(false), |
| 137 gesture_event_pending_(false), | 137 gesture_event_pending_(false), |
| 138 select_range_pending_(false), | |
| 138 needs_repainting_on_restore_(false), | 139 needs_repainting_on_restore_(false), |
| 139 is_unresponsive_(false), | 140 is_unresponsive_(false), |
| 140 in_flight_event_count_(0), | 141 in_flight_event_count_(0), |
| 141 in_get_backing_store_(false), | 142 in_get_backing_store_(false), |
| 142 abort_get_backing_store_(false), | 143 abort_get_backing_store_(false), |
| 143 view_being_painted_(false), | 144 view_being_painted_(false), |
| 144 ignore_input_events_(false), | 145 ignore_input_events_(false), |
| 145 text_direction_updated_(false), | 146 text_direction_updated_(false), |
| 146 text_direction_(WebKit::WebTextDirectionLeftToRight), | 147 text_direction_(WebKit::WebTextDirectionLeftToRight), |
| 147 text_direction_canceled_(false), | 148 text_direction_canceled_(false), |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) | 282 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) |
| 282 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) | 283 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) |
| 283 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) | 284 IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) |
| 284 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) | 285 IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) |
| 285 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, | 286 IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, |
| 286 OnCompositorSurfaceBuffersSwapped) | 287 OnCompositorSurfaceBuffersSwapped) |
| 287 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) | 288 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) |
| 288 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) | 289 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) |
| 289 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) | 290 IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) |
| 290 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) | 291 IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) |
| 292 IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck) | |
| 291 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) | 293 IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) |
| 292 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) | 294 IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) |
| 293 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, | 295 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, |
| 294 OnMsgHasTouchEventHandlers) | 296 OnMsgHasTouchEventHandlers) |
| 295 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) | 297 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) |
| 296 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, | 298 IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, |
| 297 OnMsgTextInputStateChanged) | 299 OnMsgTextInputStateChanged) |
| 298 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, | 300 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, |
| 299 OnMsgImeCompositionRangeChanged) | 301 OnMsgImeCompositionRangeChanged) |
| 300 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, | 302 IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1506 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs)); | 1508 base::TimeDelta::FromMilliseconds(kSyntheticScrollMessageIntervalMs)); |
| 1507 | 1509 |
| 1508 | 1510 |
| 1509 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this); | 1511 bool active = active_smooth_scroll_gesture_->ForwardInputEvents(now, this); |
| 1510 if (!active) { | 1512 if (!active) { |
| 1511 active_smooth_scroll_gesture_.reset(); | 1513 active_smooth_scroll_gesture_.reset(); |
| 1512 // TODO(nduca): send "smooth scroll done" event to RenderWidget. | 1514 // TODO(nduca): send "smooth scroll done" event to RenderWidget. |
| 1513 } | 1515 } |
| 1514 } | 1516 } |
| 1515 | 1517 |
| 1518 void RenderWidgetHostImpl::OnMsgSelectRangeAck() { | |
| 1519 select_range_pending_ = false; | |
| 1520 if (next_select_range_.get()) { | |
| 1521 gfx::Point start = next_select_range_->first; | |
|
darin (slow to review)
2012/08/02 16:37:17
consider using .Pass() here instead:
scoped_ptr
Iain Merrick
2012/08/06 11:28:45
Done.
| |
| 1522 gfx::Point end = next_select_range_->second; | |
| 1523 next_select_range_.reset(); | |
| 1524 SelectRange(start, end); | |
| 1525 } | |
| 1526 } | |
| 1527 | |
| 1516 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { | 1528 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { |
| 1517 mouse_wheel_pending_ = false; | 1529 mouse_wheel_pending_ = false; |
| 1518 | 1530 |
| 1519 // Now send the next (coalesced) mouse wheel event. | 1531 // Now send the next (coalesced) mouse wheel event. |
| 1520 if (!coalesced_mouse_wheel_events_.empty()) { | 1532 if (!coalesced_mouse_wheel_events_.empty()) { |
| 1521 WebMouseWheelEvent next_wheel_event = | 1533 WebMouseWheelEvent next_wheel_event = |
| 1522 coalesced_mouse_wheel_events_.front(); | 1534 coalesced_mouse_wheel_events_.front(); |
| 1523 coalesced_mouse_wheel_events_.pop_front(); | 1535 coalesced_mouse_wheel_events_.pop_front(); |
| 1524 ForwardWheelEvent(next_wheel_event); | 1536 ForwardWheelEvent(next_wheel_event); |
| 1525 } | 1537 } |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1809 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); | 1821 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); |
| 1810 } | 1822 } |
| 1811 | 1823 |
| 1812 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( | 1824 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( |
| 1813 const gfx::Rect& rect) { | 1825 const gfx::Rect& rect) { |
| 1814 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); | 1826 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); |
| 1815 } | 1827 } |
| 1816 | 1828 |
| 1817 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, | 1829 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, |
| 1818 const gfx::Point& end) { | 1830 const gfx::Point& end) { |
| 1831 if (select_range_pending_) { | |
| 1832 if (!next_select_range_.get()) { | |
| 1833 next_select_range_.reset(new std::pair<gfx::Point, gfx::Point>()); | |
| 1834 } | |
| 1835 next_select_range_->first = start; | |
| 1836 next_select_range_->second = end; | |
| 1837 return; | |
| 1838 } | |
| 1839 | |
| 1840 select_range_pending_ = true; | |
| 1819 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); | 1841 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); |
| 1820 } | 1842 } |
| 1821 | 1843 |
| 1822 void RenderWidgetHostImpl::Undo() { | 1844 void RenderWidgetHostImpl::Undo() { |
| 1823 Send(new ViewMsg_Undo(GetRoutingID())); | 1845 Send(new ViewMsg_Undo(GetRoutingID())); |
| 1824 RecordAction(UserMetricsAction("Undo")); | 1846 RecordAction(UserMetricsAction("Undo")); |
| 1825 } | 1847 } |
| 1826 | 1848 |
| 1827 void RenderWidgetHostImpl::Redo() { | 1849 void RenderWidgetHostImpl::Redo() { |
| 1828 Send(new ViewMsg_Redo(GetRoutingID())); | 1850 Send(new ViewMsg_Redo(GetRoutingID())); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1934 // indicate that no callback is in progress (i.e. without this line | 1956 // indicate that no callback is in progress (i.e. without this line |
| 1935 // DelayedAutoResized will not get called again). | 1957 // DelayedAutoResized will not get called again). |
| 1936 new_auto_size_.SetSize(0, 0); | 1958 new_auto_size_.SetSize(0, 0); |
| 1937 if (!should_auto_resize_) | 1959 if (!should_auto_resize_) |
| 1938 return; | 1960 return; |
| 1939 | 1961 |
| 1940 OnRenderAutoResized(new_size); | 1962 OnRenderAutoResized(new_size); |
| 1941 } | 1963 } |
| 1942 | 1964 |
| 1943 } // namespace content | 1965 } // namespace content |
| OLD | NEW |