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.h" | 5 #include "content/browser/renderer_host/render_widget_host.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return last_event.modifiers == new_event.modifiers && | 73 return last_event.modifiers == new_event.modifiers && |
74 last_event.scrollByPage == new_event.scrollByPage && | 74 last_event.scrollByPage == new_event.scrollByPage && |
75 last_event.hasPreciseScrollingDeltas | 75 last_event.hasPreciseScrollingDeltas |
76 == new_event.hasPreciseScrollingDeltas && | 76 == new_event.hasPreciseScrollingDeltas && |
77 last_event.phase == new_event.phase && | 77 last_event.phase == new_event.phase && |
78 last_event.momentumPhase == new_event.momentumPhase; | 78 last_event.momentumPhase == new_event.momentumPhase; |
79 } | 79 } |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process) | |
84 : process_(process), | |
85 view_(NULL) { | |
86 } | |
87 | |
88 content::RenderWidgetHostView* RenderWidgetHost::view() const { | |
89 return view_; | |
90 } | |
91 | |
92 // static | 83 // static |
93 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( | 84 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( |
94 IPC::Channel::Listener* listener) { | 85 IPC::Channel::Listener* listener) { |
95 return static_cast<RenderWidgetHost*>( | 86 return static_cast<RenderWidgetHost*>( |
96 static_cast<RenderWidgetHostImpl*>(listener)); | 87 static_cast<RenderWidgetHostImpl*>(listener)); |
97 } | 88 } |
98 | 89 |
99 // static | 90 // static |
100 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( | 91 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( |
101 const IPC::Channel::Listener* listener) { | 92 const IPC::Channel::Listener* listener) { |
102 return static_cast<const RenderWidgetHost*>( | 93 return static_cast<const RenderWidgetHost*>( |
103 static_cast<const RenderWidgetHostImpl*>(listener)); | 94 static_cast<const RenderWidgetHostImpl*>(listener)); |
104 } | 95 } |
105 | 96 |
106 // static | 97 // static |
107 void RenderWidgetHost::RemoveAllBackingStores() { | 98 void RenderWidgetHost::RemoveAllBackingStores() { |
108 BackingStoreManager::RemoveAllBackingStores(); | 99 BackingStoreManager::RemoveAllBackingStores(); |
109 } | 100 } |
110 | 101 |
111 // static | 102 // static |
112 size_t RenderWidgetHost::BackingStoreMemorySize() { | 103 size_t RenderWidgetHost::BackingStoreMemorySize() { |
113 return BackingStoreManager::MemorySize(); | 104 return BackingStoreManager::MemorySize(); |
114 } | 105 } |
115 | 106 |
116 /////////////////////////////////////////////////////////////////////////////// | 107 /////////////////////////////////////////////////////////////////////////////// |
117 // RenderWidgetHostImpl | 108 // RenderWidgetHostImpl |
118 | 109 |
119 RenderWidgetHostImpl::RenderWidgetHostImpl(content::RenderProcessHost* process, | 110 RenderWidgetHostImpl::RenderWidgetHostImpl(content::RenderProcessHost* process, |
120 int routing_id) | 111 int routing_id) |
121 : RenderWidgetHost(process), | 112 : view_(NULL), |
122 renderer_initialized_(false), | 113 renderer_initialized_(false), |
123 hung_renderer_delay_ms_(kHungRendererDelayMs), | 114 hung_renderer_delay_ms_(kHungRendererDelayMs), |
| 115 process_(process), |
| 116 routing_id_(routing_id), |
124 renderer_accessible_(false), | 117 renderer_accessible_(false), |
125 routing_id_(routing_id), | |
126 surface_id_(0), | 118 surface_id_(0), |
127 is_loading_(false), | 119 is_loading_(false), |
128 is_hidden_(false), | 120 is_hidden_(false), |
129 is_accelerated_compositing_active_(false), | 121 is_accelerated_compositing_active_(false), |
130 repaint_ack_pending_(false), | 122 repaint_ack_pending_(false), |
131 resize_ack_pending_(false), | 123 resize_ack_pending_(false), |
132 should_auto_resize_(false), | 124 should_auto_resize_(false), |
133 mouse_move_pending_(false), | 125 mouse_move_pending_(false), |
134 mouse_wheel_pending_(false), | 126 mouse_wheel_pending_(false), |
135 needs_repainting_on_restore_(false), | 127 needs_repainting_on_restore_(false), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 180 |
189 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); | 181 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); |
190 surface_id_ = 0; | 182 surface_id_ = 0; |
191 | 183 |
192 process_->Release(routing_id_); | 184 process_->Release(routing_id_); |
193 } | 185 } |
194 | 186 |
195 // static | 187 // static |
196 RenderWidgetHostImpl* RenderWidgetHostImpl::FromRWHV( | 188 RenderWidgetHostImpl* RenderWidgetHostImpl::FromRWHV( |
197 content::RenderWidgetHostView* rwhv) { | 189 content::RenderWidgetHostView* rwhv) { |
198 return static_cast<RenderWidgetHostImpl*>(rwhv->GetRenderWidgetHost()); | 190 return rwhv->GetRenderWidgetHost()->AsRWHImpl(); |
199 } | 191 } |
200 | 192 |
201 void RenderWidgetHostImpl::SetView(content::RenderWidgetHostView* view) { | 193 void RenderWidgetHostImpl::SetView(content::RenderWidgetHostView* view) { |
202 view_ = RenderWidgetHostViewPort::FromRWHV(view); | 194 view_ = RenderWidgetHostViewPort::FromRWHV(view); |
203 | 195 |
204 if (!view_) { | 196 if (!view_) { |
205 GpuSurfaceTracker::Get()->SetSurfaceHandle( | 197 GpuSurfaceTracker::Get()->SetSurfaceHandle( |
206 surface_id_, gfx::GLSurfaceHandle()); | 198 surface_id_, gfx::GLSurfaceHandle()); |
207 } | 199 } |
208 } | 200 } |
209 | 201 |
| 202 content::RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { |
| 203 return process_; |
| 204 } |
| 205 |
| 206 int RenderWidgetHostImpl::GetRoutingID() const { |
| 207 return routing_id_; |
| 208 } |
| 209 |
| 210 content::RenderWidgetHostView* RenderWidgetHostImpl::GetView() const { |
| 211 return view_; |
| 212 } |
| 213 |
| 214 RenderWidgetHostImpl* RenderWidgetHostImpl::AsRWHImpl() { |
| 215 return this; |
| 216 } |
| 217 |
| 218 bool RenderWidgetHostImpl::OnMessageReceivedForTesting( |
| 219 const IPC::Message& msg) { |
| 220 return OnMessageReceived(msg); |
| 221 } |
| 222 |
210 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const { | 223 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const { |
211 if (view_) | 224 if (view_) |
212 return view_->GetNativeViewId(); | 225 return view_->GetNativeViewId(); |
213 return 0; | 226 return 0; |
214 } | 227 } |
215 | 228 |
216 gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() { | 229 gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() { |
217 if (view_) | 230 if (view_) |
218 return view_->GetCompositingSurface(); | 231 return view_->GetCompositingSurface(); |
219 return gfx::GLSurfaceHandle(); | 232 return gfx::GLSurfaceHandle(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 OnMsgCreatePluginContainer) | 319 OnMsgCreatePluginContainer) |
307 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, | 320 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, |
308 OnMsgDestroyPluginContainer) | 321 OnMsgDestroyPluginContainer) |
309 #endif | 322 #endif |
310 IPC_MESSAGE_UNHANDLED(handled = false) | 323 IPC_MESSAGE_UNHANDLED(handled = false) |
311 IPC_END_MESSAGE_MAP_EX() | 324 IPC_END_MESSAGE_MAP_EX() |
312 | 325 |
313 if (!msg_is_ok) { | 326 if (!msg_is_ok) { |
314 // The message de-serialization failed. Kill the renderer process. | 327 // The message de-serialization failed. Kill the renderer process. |
315 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); | 328 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); |
316 process()->ReceivedBadMessage(); | 329 GetProcess()->ReceivedBadMessage(); |
317 } | 330 } |
318 return handled; | 331 return handled; |
319 } | 332 } |
320 | 333 |
321 bool RenderWidgetHostImpl::Send(IPC::Message* msg) { | 334 bool RenderWidgetHostImpl::Send(IPC::Message* msg) { |
322 return process_->Send(msg); | 335 return process_->Send(msg); |
323 } | 336 } |
324 | 337 |
325 void RenderWidgetHostImpl::WasHidden() { | 338 void RenderWidgetHostImpl::WasHidden() { |
326 is_hidden_ = true; | 339 is_hidden_ = true; |
327 | 340 |
328 // Don't bother reporting hung state when we aren't the active tab. | 341 // Don't bother reporting hung state when we aren't the active tab. |
329 StopHangMonitorTimeout(); | 342 StopHangMonitorTimeout(); |
330 | 343 |
331 // If we have a renderer, then inform it that we are being hidden so it can | 344 // If we have a renderer, then inform it that we are being hidden so it can |
332 // reduce its resource utilization. | 345 // reduce its resource utilization. |
333 Send(new ViewMsg_WasHidden(routing_id_)); | 346 Send(new ViewMsg_WasHidden(routing_id_)); |
334 | 347 |
335 // Tell the RenderProcessHost we were hidden. | 348 // Tell the RenderProcessHost we were hidden. |
336 process_->WidgetHidden(); | 349 process_->WidgetHidden(); |
337 | 350 |
338 bool is_visible = false; | 351 bool is_visible = false; |
339 content::NotificationService::current()->Notify( | 352 content::NotificationService::current()->Notify( |
340 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 353 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
341 content::Source<RenderWidgetHostImpl>(this), | 354 content::Source<RenderWidgetHost>(this), |
342 content::Details<bool>(&is_visible)); | 355 content::Details<bool>(&is_visible)); |
343 } | 356 } |
344 | 357 |
345 void RenderWidgetHostImpl::WasRestored() { | 358 void RenderWidgetHostImpl::WasRestored() { |
346 // When we create the widget, it is created as *not* hidden. | 359 // When we create the widget, it is created as *not* hidden. |
347 if (!is_hidden_) | 360 if (!is_hidden_) |
348 return; | 361 return; |
349 is_hidden_ = false; | 362 is_hidden_ = false; |
350 | 363 |
351 BackingStore* backing_store = BackingStoreManager::Lookup(this); | 364 BackingStore* backing_store = BackingStoreManager::Lookup(this); |
352 // If we already have a backing store for this widget, then we don't need to | 365 // If we already have a backing store for this widget, then we don't need to |
353 // repaint on restore _unless_ we know that our backing store is invalid. | 366 // repaint on restore _unless_ we know that our backing store is invalid. |
354 // When accelerated compositing is on, we must always repaint, even when | 367 // When accelerated compositing is on, we must always repaint, even when |
355 // the backing store exists. | 368 // the backing store exists. |
356 bool needs_repainting; | 369 bool needs_repainting; |
357 if (needs_repainting_on_restore_ || !backing_store || | 370 if (needs_repainting_on_restore_ || !backing_store || |
358 is_accelerated_compositing_active()) { | 371 is_accelerated_compositing_active()) { |
359 needs_repainting = true; | 372 needs_repainting = true; |
360 needs_repainting_on_restore_ = false; | 373 needs_repainting_on_restore_ = false; |
361 } else { | 374 } else { |
362 needs_repainting = false; | 375 needs_repainting = false; |
363 } | 376 } |
364 Send(new ViewMsg_WasRestored(routing_id_, needs_repainting)); | 377 Send(new ViewMsg_WasRestored(routing_id_, needs_repainting)); |
365 | 378 |
366 process_->WidgetRestored(); | 379 process_->WidgetRestored(); |
367 | 380 |
368 bool is_visible = true; | 381 bool is_visible = true; |
369 content::NotificationService::current()->Notify( | 382 content::NotificationService::current()->Notify( |
370 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, | 383 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, |
371 content::Source<RenderWidgetHostImpl>(this), | 384 content::Source<RenderWidgetHost>(this), |
372 content::Details<bool>(&is_visible)); | 385 content::Details<bool>(&is_visible)); |
373 | 386 |
374 // It's possible for our size to be out of sync with the renderer. The | 387 // It's possible for our size to be out of sync with the renderer. The |
375 // following is one case that leads to this: | 388 // following is one case that leads to this: |
376 // 1. WasResized -> Send ViewMsg_Resize to render | 389 // 1. WasResized -> Send ViewMsg_Resize to render |
377 // 2. WasResized -> do nothing as resize_ack_pending_ is true | 390 // 2. WasResized -> do nothing as resize_ack_pending_ is true |
378 // 3. WasHidden | 391 // 3. WasHidden |
379 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view | 392 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view |
380 // is hidden. Now renderer/browser out of sync with what they think size | 393 // is hidden. Now renderer/browser out of sync with what they think size |
381 // is. | 394 // is. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 return backing_store; | 583 return backing_store; |
571 } | 584 } |
572 | 585 |
573 BackingStore* RenderWidgetHostImpl::AllocBackingStore(const gfx::Size& size) { | 586 BackingStore* RenderWidgetHostImpl::AllocBackingStore(const gfx::Size& size) { |
574 if (!view_) | 587 if (!view_) |
575 return NULL; | 588 return NULL; |
576 return view_->AllocBackingStore(size); | 589 return view_->AllocBackingStore(size); |
577 } | 590 } |
578 | 591 |
579 void RenderWidgetHostImpl::DonePaintingToBackingStore() { | 592 void RenderWidgetHostImpl::DonePaintingToBackingStore() { |
580 Send(new ViewMsg_UpdateRect_ACK(routing_id())); | 593 Send(new ViewMsg_UpdateRect_ACK(GetRoutingID())); |
581 } | 594 } |
582 | 595 |
583 void RenderWidgetHostImpl::ScheduleComposite() { | 596 void RenderWidgetHostImpl::ScheduleComposite() { |
584 if (is_hidden_ || !is_accelerated_compositing_active_) { | 597 if (is_hidden_ || !is_accelerated_compositing_active_) { |
585 return; | 598 return; |
586 } | 599 } |
587 | 600 |
588 // Send out a request to the renderer to paint the view if required. | 601 // Send out a request to the renderer to paint the view if required. |
589 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { | 602 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { |
590 repaint_start_time_ = TimeTicks::Now(); | 603 repaint_start_time_ = TimeTicks::Now(); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 } | 881 } |
869 | 882 |
870 void RenderWidgetHostImpl::CancelUpdateTextDirection() { | 883 void RenderWidgetHostImpl::CancelUpdateTextDirection() { |
871 if (text_direction_updated_) | 884 if (text_direction_updated_) |
872 text_direction_canceled_ = true; | 885 text_direction_canceled_ = true; |
873 } | 886 } |
874 | 887 |
875 void RenderWidgetHostImpl::NotifyTextDirection() { | 888 void RenderWidgetHostImpl::NotifyTextDirection() { |
876 if (text_direction_updated_) { | 889 if (text_direction_updated_) { |
877 if (!text_direction_canceled_) | 890 if (!text_direction_canceled_) |
878 Send(new ViewMsg_SetTextDirection(routing_id(), text_direction_)); | 891 Send(new ViewMsg_SetTextDirection(GetRoutingID(), text_direction_)); |
879 text_direction_updated_ = false; | 892 text_direction_updated_ = false; |
880 text_direction_canceled_ = false; | 893 text_direction_canceled_ = false; |
881 } | 894 } |
882 } | 895 } |
883 | 896 |
884 void RenderWidgetHostImpl::SetInputMethodActive(bool activate) { | 897 void RenderWidgetHostImpl::SetInputMethodActive(bool activate) { |
885 Send(new ViewMsg_SetInputMethodActive(routing_id(), activate)); | 898 Send(new ViewMsg_SetInputMethodActive(GetRoutingID(), activate)); |
886 } | 899 } |
887 | 900 |
888 void RenderWidgetHostImpl::ImeSetComposition( | 901 void RenderWidgetHostImpl::ImeSetComposition( |
889 const string16& text, | 902 const string16& text, |
890 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 903 const std::vector<WebKit::WebCompositionUnderline>& underlines, |
891 int selection_start, | 904 int selection_start, |
892 int selection_end) { | 905 int selection_end) { |
893 Send(new ViewMsg_ImeSetComposition( | 906 Send(new ViewMsg_ImeSetComposition( |
894 routing_id(), text, underlines, selection_start, selection_end)); | 907 GetRoutingID(), text, underlines, selection_start, selection_end)); |
895 } | 908 } |
896 | 909 |
897 void RenderWidgetHostImpl::ImeConfirmComposition(const string16& text) { | 910 void RenderWidgetHostImpl::ImeConfirmComposition(const string16& text) { |
898 ImeConfirmComposition(text, ui::Range::InvalidRange()); | 911 ImeConfirmComposition(text, ui::Range::InvalidRange()); |
899 } | 912 } |
900 | 913 |
901 void RenderWidgetHostImpl::ImeConfirmComposition( | 914 void RenderWidgetHostImpl::ImeConfirmComposition( |
902 const string16& text, const ui::Range& replacement_range) { | 915 const string16& text, const ui::Range& replacement_range) { |
903 Send(new ViewMsg_ImeConfirmComposition( | 916 Send(new ViewMsg_ImeConfirmComposition( |
904 routing_id(), text, replacement_range)); | 917 GetRoutingID(), text, replacement_range)); |
905 } | 918 } |
906 | 919 |
907 void RenderWidgetHostImpl::ImeConfirmComposition() { | 920 void RenderWidgetHostImpl::ImeConfirmComposition() { |
908 ImeConfirmComposition(string16()); | 921 ImeConfirmComposition(string16()); |
909 } | 922 } |
910 | 923 |
911 void RenderWidgetHostImpl::ImeCancelComposition() { | 924 void RenderWidgetHostImpl::ImeCancelComposition() { |
912 Send(new ViewMsg_ImeSetComposition(routing_id(), string16(), | 925 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(), |
913 std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); | 926 std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); |
914 } | 927 } |
915 | 928 |
916 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { | 929 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { |
917 return gfx::Rect(); | 930 return gfx::Rect(); |
918 } | 931 } |
919 | 932 |
920 void RenderWidgetHostImpl::RequestToLockMouse() { | 933 void RenderWidgetHostImpl::RequestToLockMouse() { |
921 // Directly reject to lock the mouse. Subclass can override this method to | 934 // Directly reject to lock the mouse. Subclass can override this method to |
922 // decide whether to allow mouse lock or not. | 935 // decide whether to allow mouse lock or not. |
(...skipping 28 matching lines...) Expand all Loading... |
951 DCHECK(enable); | 964 DCHECK(enable); |
952 | 965 |
953 // TODO: Change this to enable instead of true when this supports turning | 966 // TODO: Change this to enable instead of true when this supports turning |
954 // off auto-resize. | 967 // off auto-resize. |
955 should_auto_resize_ = true; | 968 should_auto_resize_ = true; |
956 } | 969 } |
957 | 970 |
958 void RenderWidgetHostImpl::Destroy() { | 971 void RenderWidgetHostImpl::Destroy() { |
959 content::NotificationService::current()->Notify( | 972 content::NotificationService::current()->Notify( |
960 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 973 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
961 content::Source<RenderWidgetHostImpl>(this), | 974 content::Source<RenderWidgetHost>(this), |
962 content::NotificationService::NoDetails()); | 975 content::NotificationService::NoDetails()); |
963 | 976 |
964 // Tell the view to die. | 977 // Tell the view to die. |
965 // Note that in the process of the view shutting down, it can call a ton | 978 // Note that in the process of the view shutting down, it can call a ton |
966 // of other messages on us. So if you do any other deinitialization here, | 979 // of other messages on us. So if you do any other deinitialization here, |
967 // do it after this call to view_->Destroy(). | 980 // do it after this call to view_->Destroy(). |
968 if (view_) | 981 if (view_) |
969 view_->Destroy(); | 982 view_->Destroy(); |
970 | 983 |
971 delete this; | 984 delete this; |
972 } | 985 } |
973 | 986 |
974 void RenderWidgetHostImpl::CheckRendererIsUnresponsive() { | 987 void RenderWidgetHostImpl::CheckRendererIsUnresponsive() { |
975 // If we received a call to StopHangMonitorTimeout. | 988 // If we received a call to StopHangMonitorTimeout. |
976 if (time_when_considered_hung_.is_null()) | 989 if (time_when_considered_hung_.is_null()) |
977 return; | 990 return; |
978 | 991 |
979 // If we have not waited long enough, then wait some more. | 992 // If we have not waited long enough, then wait some more. |
980 Time now = Time::Now(); | 993 Time now = Time::Now(); |
981 if (now < time_when_considered_hung_) { | 994 if (now < time_when_considered_hung_) { |
982 StartHangMonitorTimeout(time_when_considered_hung_ - now); | 995 StartHangMonitorTimeout(time_when_considered_hung_ - now); |
983 return; | 996 return; |
984 } | 997 } |
985 | 998 |
986 // OK, looks like we have a hung renderer! | 999 // OK, looks like we have a hung renderer! |
987 content::NotificationService::current()->Notify( | 1000 content::NotificationService::current()->Notify( |
988 content::NOTIFICATION_RENDERER_PROCESS_HANG, | 1001 content::NOTIFICATION_RENDERER_PROCESS_HANG, |
989 content::Source<RenderWidgetHostImpl>(this), | 1002 content::Source<RenderWidgetHost>(this), |
990 content::NotificationService::NoDetails()); | 1003 content::NotificationService::NoDetails()); |
991 is_unresponsive_ = true; | 1004 is_unresponsive_ = true; |
992 NotifyRendererUnresponsive(); | 1005 NotifyRendererUnresponsive(); |
993 } | 1006 } |
994 | 1007 |
995 void RenderWidgetHostImpl::RendererIsResponsive() { | 1008 void RenderWidgetHostImpl::RendererIsResponsive() { |
996 if (is_unresponsive_) { | 1009 if (is_unresponsive_) { |
997 is_unresponsive_ = false; | 1010 is_unresponsive_ = false; |
998 NotifyRendererResponsive(); | 1011 NotifyRendererResponsive(); |
999 } | 1012 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { | 1048 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { |
1036 // Force the tooltip to have LTR directionality. | 1049 // Force the tooltip to have LTR directionality. |
1037 wrapped_tooltip_text = | 1050 wrapped_tooltip_text = |
1038 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); | 1051 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); |
1039 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && | 1052 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && |
1040 !base::i18n::IsRTL()) { | 1053 !base::i18n::IsRTL()) { |
1041 // Force the tooltip to have RTL directionality. | 1054 // Force the tooltip to have RTL directionality. |
1042 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); | 1055 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); |
1043 } | 1056 } |
1044 } | 1057 } |
1045 if (view()) | 1058 if (GetView()) |
1046 view_->SetTooltipText(wrapped_tooltip_text); | 1059 view_->SetTooltipText(wrapped_tooltip_text); |
1047 } | 1060 } |
1048 | 1061 |
1049 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { | 1062 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { |
1050 // Note that we ignore the position. | 1063 // Note that we ignore the position. |
1051 if (view_) { | 1064 if (view_) { |
1052 view_->SetBounds(pos); | 1065 view_->SetBounds(pos); |
1053 Send(new ViewMsg_Move_ACK(routing_id_)); | 1066 Send(new ViewMsg_Move_ACK(routing_id_)); |
1054 } | 1067 } |
1055 } | 1068 } |
1056 | 1069 |
1057 void RenderWidgetHostImpl::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { | 1070 void RenderWidgetHostImpl::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { |
1058 PaintAtSizeAckDetails details = {tag, size}; | 1071 PaintAtSizeAckDetails details = {tag, size}; |
1059 gfx::Size size_details = size; | 1072 gfx::Size size_details = size; |
1060 content::NotificationService::current()->Notify( | 1073 content::NotificationService::current()->Notify( |
1061 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, | 1074 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, |
1062 content::Source<RenderWidgetHostImpl>(this), | 1075 content::Source<RenderWidgetHost>(this), |
1063 content::Details<PaintAtSizeAckDetails>(&details)); | 1076 content::Details<PaintAtSizeAckDetails>(&details)); |
1064 } | 1077 } |
1065 | 1078 |
1066 void RenderWidgetHostImpl::OnMsgUpdateRect( | 1079 void RenderWidgetHostImpl::OnMsgUpdateRect( |
1067 const ViewHostMsg_UpdateRect_Params& params) { | 1080 const ViewHostMsg_UpdateRect_Params& params) { |
1068 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect"); | 1081 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect"); |
1069 TimeTicks paint_start = TimeTicks::Now(); | 1082 TimeTicks paint_start = TimeTicks::Now(); |
1070 | 1083 |
1071 // Update our knowledge of the RenderWidget's size. | 1084 // Update our knowledge of the RenderWidget's size. |
1072 current_size_ = params.view_size; | 1085 current_size_ = params.view_size; |
(...skipping 30 matching lines...) Expand all Loading... |
1103 params.bitmap_rect.width() * 4; | 1116 params.bitmap_rect.width() * 4; |
1104 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); | 1117 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); |
1105 | 1118 |
1106 // If gpu process does painting, scroll_rect and copy_rects are always empty | 1119 // If gpu process does painting, scroll_rect and copy_rects are always empty |
1107 // and backing store is never used. | 1120 // and backing store is never used. |
1108 if (dib) { | 1121 if (dib) { |
1109 if (dib->size() < size) { | 1122 if (dib->size() < size) { |
1110 DLOG(WARNING) << "Transport DIB too small for given rectangle"; | 1123 DLOG(WARNING) << "Transport DIB too small for given rectangle"; |
1111 content::RecordAction( | 1124 content::RecordAction( |
1112 UserMetricsAction("BadMessageTerminate_RWH1")); | 1125 UserMetricsAction("BadMessageTerminate_RWH1")); |
1113 process()->ReceivedBadMessage(); | 1126 GetProcess()->ReceivedBadMessage(); |
1114 } else { | 1127 } else { |
1115 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", | 1128 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", |
1116 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), | 1129 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), |
1117 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); | 1130 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); |
1118 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", | 1131 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", |
1119 "width", params.bitmap_rect.width()); | 1132 "width", params.bitmap_rect.width()); |
1120 | 1133 |
1121 // Scroll the backing store. | 1134 // Scroll the backing store. |
1122 if (!params.scroll_rect.IsEmpty()) { | 1135 if (!params.scroll_rect.IsEmpty()) { |
1123 ScrollBackingStoreRect(params.dx, params.dy, | 1136 ScrollBackingStoreRect(params.dx, params.dy, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 // Now paint the view. Watch out: it might be destroyed already. | 1202 // Now paint the view. Watch out: it might be destroyed already. |
1190 if (view_ && !is_accelerated_compositing_active_) { | 1203 if (view_ && !is_accelerated_compositing_active_) { |
1191 view_being_painted_ = true; | 1204 view_being_painted_ = true; |
1192 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy, | 1205 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy, |
1193 params.copy_rects); | 1206 params.copy_rects); |
1194 view_being_painted_ = false; | 1207 view_being_painted_ = false; |
1195 } | 1208 } |
1196 | 1209 |
1197 content::NotificationService::current()->Notify( | 1210 content::NotificationService::current()->Notify( |
1198 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, | 1211 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, |
1199 content::Source<RenderWidgetHostImpl>(this), | 1212 content::Source<RenderWidgetHost>(this), |
1200 content::NotificationService::NoDetails()); | 1213 content::NotificationService::NoDetails()); |
1201 | 1214 |
1202 // If we got a resize ack, then perhaps we have another resize to send? | 1215 // If we got a resize ack, then perhaps we have another resize to send? |
1203 bool is_resize_ack = | 1216 bool is_resize_ack = |
1204 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); | 1217 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); |
1205 if (is_resize_ack && view_) { | 1218 if (is_resize_ack && view_) { |
1206 gfx::Rect view_bounds = view_->GetViewBounds(); | 1219 gfx::Rect view_bounds = view_->GetViewBounds(); |
1207 if (current_size_ != view_bounds.size()) | 1220 if (current_size_ != view_bounds.size()) |
1208 WasResized(); | 1221 WasResized(); |
1209 } | 1222 } |
1210 | 1223 |
1211 // Log the time delta for processing a paint message. | 1224 // Log the time delta for processing a paint message. |
1212 TimeTicks now = TimeTicks::Now(); | 1225 TimeTicks now = TimeTicks::Now(); |
1213 TimeDelta delta = now - update_start; | 1226 TimeDelta delta = now - update_start; |
1214 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); | 1227 UMA_HISTOGRAM_TIMES("MPArch.RWH_DidUpdateBackingStore", delta); |
1215 | 1228 |
1216 // Measures the time from receiving the MsgUpdateRect IPC to completing the | 1229 // Measures the time from receiving the MsgUpdateRect IPC to completing the |
1217 // DidUpdateBackingStore() method. On platforms which have asynchronous | 1230 // DidUpdateBackingStore() method. On platforms which have asynchronous |
1218 // painting, such as Linux, this is the sum of MPArch.RWH_OnMsgUpdateRect, | 1231 // painting, such as Linux, this is the sum of MPArch.RWH_OnMsgUpdateRect, |
1219 // MPArch.RWH_DidUpdateBackingStore, and the time spent asynchronously | 1232 // MPArch.RWH_DidUpdateBackingStore, and the time spent asynchronously |
1220 // waiting for the paint to complete. | 1233 // waiting for the paint to complete. |
1221 // | 1234 // |
1222 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. | 1235 // On other platforms, this will be equivalent to MPArch.RWH_OnMsgUpdateRect. |
1223 delta = now - paint_start; | 1236 delta = now - paint_start; |
1224 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); | 1237 UMA_HISTOGRAM_TIMES("MPArch.RWH_TotalPaintTime", delta); |
1225 } | 1238 } |
1226 | 1239 |
1227 void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type, | 1240 void RenderWidgetHostImpl::OnMsgInputEventAck(WebInputEvent::Type event_type, |
1228 bool processed) { | 1241 bool processed) { |
1229 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgInputEventAck"); | 1242 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgInputEventAck"); |
1230 | 1243 |
1231 // Log the time delta for processing an input event. | 1244 // Log the time delta for processing an input event. |
1232 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; | 1245 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; |
1233 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); | 1246 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); |
1234 | 1247 |
1235 // Cancel pending hung renderer checks since the renderer is responsive. | 1248 // Cancel pending hung renderer checks since the renderer is responsive. |
1236 if (--in_flight_event_count_ == 0) | 1249 if (--in_flight_event_count_ == 0) |
1237 StopHangMonitorTimeout(); | 1250 StopHangMonitorTimeout(); |
1238 | 1251 |
1239 int type = static_cast<int>(event_type); | 1252 int type = static_cast<int>(event_type); |
1240 if (type < WebInputEvent::Undefined) { | 1253 if (type < WebInputEvent::Undefined) { |
1241 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2")); | 1254 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2")); |
1242 process()->ReceivedBadMessage(); | 1255 process_->ReceivedBadMessage(); |
1243 } else if (type == WebInputEvent::MouseMove) { | 1256 } else if (type == WebInputEvent::MouseMove) { |
1244 mouse_move_pending_ = false; | 1257 mouse_move_pending_ = false; |
1245 | 1258 |
1246 // now, we can send the next mouse move event | 1259 // now, we can send the next mouse move event |
1247 if (next_mouse_move_.get()) { | 1260 if (next_mouse_move_.get()) { |
1248 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); | 1261 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); |
1249 ForwardMouseEvent(*next_mouse_move_); | 1262 ForwardMouseEvent(*next_mouse_move_); |
1250 } | 1263 } |
1251 } else if (WebInputEvent::isKeyboardEventType(type)) { | 1264 } else if (WebInputEvent::isKeyboardEventType(type)) { |
1252 ProcessKeyboardEventAck(type, processed); | 1265 ProcessKeyboardEventAck(type, processed); |
1253 } else if (type == WebInputEvent::MouseWheel) { | 1266 } else if (type == WebInputEvent::MouseWheel) { |
1254 ProcessWheelAck(processed); | 1267 ProcessWheelAck(processed); |
1255 } else if (WebInputEvent::isTouchEventType(type)) { | 1268 } else if (WebInputEvent::isTouchEventType(type)) { |
1256 ProcessTouchAck(processed); | 1269 ProcessTouchAck(processed); |
1257 } | 1270 } |
1258 // This is used only for testing. | 1271 |
| 1272 // This is used only for testing, and the other end does not use the |
| 1273 // source object. On linux, specifying |
| 1274 // content::Source<RenderWidgetHost> results in a very strange |
| 1275 // runtime error in the epilogue of the enclosing |
| 1276 // (OnMsgInputEventAck) method, but not on other platforms; using |
| 1277 // 'void' instead is just as safe (since content::NotificationSource |
| 1278 // is not actually typesafe) and avoids this error. |
1259 content::NotificationService::current()->Notify( | 1279 content::NotificationService::current()->Notify( |
1260 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, | 1280 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, |
1261 content::Source<RenderWidgetHostImpl>(this), | 1281 content::Source<void>(this), |
1262 content::Details<int>(&type)); | 1282 content::Details<int>(&type)); |
1263 } | 1283 } |
1264 | 1284 |
1265 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { | 1285 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { |
1266 mouse_wheel_pending_ = false; | 1286 mouse_wheel_pending_ = false; |
1267 | 1287 |
1268 // Now send the next (coalesced) mouse wheel event. | 1288 // Now send the next (coalesced) mouse wheel event. |
1269 if (!coalesced_mouse_wheel_events_.empty()) { | 1289 if (!coalesced_mouse_wheel_events_.empty()) { |
1270 WebMouseWheelEvent next_wheel_event = | 1290 WebMouseWheelEvent next_wheel_event = |
1271 coalesced_mouse_wheel_events_.front(); | 1291 coalesced_mouse_wheel_events_.front(); |
1272 coalesced_mouse_wheel_events_.pop_front(); | 1292 coalesced_mouse_wheel_events_.pop_front(); |
1273 ForwardWheelEvent(next_wheel_event); | 1293 ForwardWheelEvent(next_wheel_event); |
1274 } | 1294 } |
1275 | 1295 |
1276 if (!processed && !is_hidden_ && view_) | 1296 if (!processed && !is_hidden_ && view_) |
1277 view_->UnhandledWheelEvent(current_wheel_event_); | 1297 view_->UnhandledWheelEvent(current_wheel_event_); |
1278 } | 1298 } |
1279 | 1299 |
1280 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) { | 1300 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) { |
1281 if (view_) | 1301 if (view_) |
1282 view_->ProcessTouchAck(processed); | 1302 view_->ProcessTouchAck(processed); |
1283 } | 1303 } |
1284 | 1304 |
1285 void RenderWidgetHostImpl::OnMsgFocus() { | 1305 void RenderWidgetHostImpl::OnMsgFocus() { |
1286 // Only RenderViewHost can deal with that message. | 1306 // Only RenderViewHost can deal with that message. |
1287 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); | 1307 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); |
1288 process()->ReceivedBadMessage(); | 1308 GetProcess()->ReceivedBadMessage(); |
1289 } | 1309 } |
1290 | 1310 |
1291 void RenderWidgetHostImpl::OnMsgBlur() { | 1311 void RenderWidgetHostImpl::OnMsgBlur() { |
1292 // Only RenderViewHost can deal with that message. | 1312 // Only RenderViewHost can deal with that message. |
1293 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); | 1313 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); |
1294 process()->ReceivedBadMessage(); | 1314 GetProcess()->ReceivedBadMessage(); |
1295 } | 1315 } |
1296 | 1316 |
1297 void RenderWidgetHostImpl::OnMsgDidChangeNumTouchEvents(int count) { | 1317 void RenderWidgetHostImpl::OnMsgDidChangeNumTouchEvents(int count) { |
1298 has_touch_handler_ = count > 0; | 1318 has_touch_handler_ = count > 0; |
1299 } | 1319 } |
1300 | 1320 |
1301 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { | 1321 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { |
1302 if (!view_) { | 1322 if (!view_) { |
1303 return; | 1323 return; |
1304 } | 1324 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 | 1455 |
1436 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1456 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1437 switches::kDisableRendererAccessibility)) { | 1457 switches::kDisableRendererAccessibility)) { |
1438 return; | 1458 return; |
1439 } | 1459 } |
1440 | 1460 |
1441 renderer_accessible_ = true; | 1461 renderer_accessible_ = true; |
1442 | 1462 |
1443 if (process_->HasConnection()) { | 1463 if (process_->HasConnection()) { |
1444 // Renderer accessibility wasn't enabled on process launch. Enable it now. | 1464 // Renderer accessibility wasn't enabled on process launch. Enable it now. |
1445 Send(new AccessibilityMsg_Enable(routing_id())); | 1465 Send(new AccessibilityMsg_Enable(GetRoutingID())); |
1446 } | 1466 } |
1447 } | 1467 } |
1448 | 1468 |
| 1469 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) { |
| 1470 ignore_input_events_ = ignore_input_events; |
| 1471 } |
| 1472 |
1449 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) { | 1473 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) { |
1450 if (key_queue_.empty()) { | 1474 if (key_queue_.empty()) { |
1451 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " | 1475 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " |
1452 << "don't seem to have sent it to the renderer!"; | 1476 << "don't seem to have sent it to the renderer!"; |
1453 } else if (key_queue_.front().type != type) { | 1477 } else if (key_queue_.front().type != type) { |
1454 LOG(ERROR) << "We seem to have a different key type sent from " | 1478 LOG(ERROR) << "We seem to have a different key type sent from " |
1455 << "the renderer. (" << key_queue_.front().type << " vs. " | 1479 << "the renderer. (" << key_queue_.front().type << " vs. " |
1456 << type << "). Ignoring event."; | 1480 << type << "). Ignoring event."; |
1457 | 1481 |
1458 // Something must be wrong. Clear the |key_queue_| and | 1482 // Something must be wrong. Clear the |key_queue_| and |
(...skipping 30 matching lines...) Expand all Loading... |
1489 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { | 1513 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { |
1490 #if defined(TOOLKIT_USES_GTK) | 1514 #if defined(TOOLKIT_USES_GTK) |
1491 view_->CreatePluginContainer(deferred_plugin_handles_[i]); | 1515 view_->CreatePluginContainer(deferred_plugin_handles_[i]); |
1492 #endif | 1516 #endif |
1493 } | 1517 } |
1494 | 1518 |
1495 deferred_plugin_handles_.clear(); | 1519 deferred_plugin_handles_.clear(); |
1496 #endif | 1520 #endif |
1497 } | 1521 } |
1498 | 1522 |
| 1523 const gfx::Point& RenderWidgetHostImpl::GetLastScrollOffset() const { |
| 1524 return last_scroll_offset_; |
| 1525 } |
| 1526 |
1499 void RenderWidgetHostImpl::StartUserGesture() { | 1527 void RenderWidgetHostImpl::StartUserGesture() { |
1500 OnUserGesture(); | 1528 OnUserGesture(); |
1501 } | 1529 } |
1502 | 1530 |
1503 void RenderWidgetHostImpl::Stop() { | 1531 void RenderWidgetHostImpl::Stop() { |
1504 Send(new ViewMsg_Stop(routing_id())); | 1532 Send(new ViewMsg_Stop(GetRoutingID())); |
1505 } | 1533 } |
1506 | 1534 |
1507 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { | 1535 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { |
1508 Send(new ViewMsg_SetBackground(routing_id(), background)); | 1536 Send(new ViewMsg_SetBackground(GetRoutingID(), background)); |
1509 } | 1537 } |
1510 | 1538 |
1511 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( | 1539 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( |
1512 const std::vector<EditCommand>& commands) { | 1540 const std::vector<EditCommand>& commands) { |
1513 Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), commands)); | 1541 Send(new ViewMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands)); |
1514 } | 1542 } |
1515 | 1543 |
1516 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { | 1544 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { |
1517 Send(new AccessibilityMsg_DoDefaultAction(routing_id(), object_id)); | 1545 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id)); |
1518 } | 1546 } |
1519 | 1547 |
1520 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { | 1548 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { |
1521 Send(new AccessibilityMsg_SetFocus(routing_id(), object_id)); | 1549 Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id)); |
1522 } | 1550 } |
1523 | 1551 |
1524 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible( | 1552 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible( |
1525 int acc_obj_id, gfx::Rect subfocus) { | 1553 int acc_obj_id, gfx::Rect subfocus) { |
1526 Send(new AccessibilityMsg_ScrollToMakeVisible( | 1554 Send(new AccessibilityMsg_ScrollToMakeVisible( |
1527 routing_id(), acc_obj_id, subfocus)); | 1555 GetRoutingID(), acc_obj_id, subfocus)); |
1528 } | 1556 } |
1529 | 1557 |
1530 void RenderWidgetHostImpl::AccessibilityScrollToPoint( | 1558 void RenderWidgetHostImpl::AccessibilityScrollToPoint( |
1531 int acc_obj_id, gfx::Point point) { | 1559 int acc_obj_id, gfx::Point point) { |
1532 Send(new AccessibilityMsg_ScrollToPoint( | 1560 Send(new AccessibilityMsg_ScrollToPoint( |
1533 routing_id(), acc_obj_id, point)); | 1561 GetRoutingID(), acc_obj_id, point)); |
1534 } | 1562 } |
1535 | 1563 |
1536 void RenderWidgetHostImpl::AccessibilitySetTextSelection( | 1564 void RenderWidgetHostImpl::AccessibilitySetTextSelection( |
1537 int object_id, int start_offset, int end_offset) { | 1565 int object_id, int start_offset, int end_offset) { |
1538 Send(new AccessibilityMsg_SetTextSelection( | 1566 Send(new AccessibilityMsg_SetTextSelection( |
1539 routing_id(), object_id, start_offset, end_offset)); | 1567 GetRoutingID(), object_id, start_offset, end_offset)); |
1540 } | 1568 } |
1541 | 1569 |
1542 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, | 1570 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, |
1543 const std::string& value) { | 1571 const std::string& value) { |
1544 Send(new ViewMsg_ExecuteEditCommand(routing_id(), command, value)); | 1572 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value)); |
1545 } | 1573 } |
1546 | 1574 |
1547 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( | 1575 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( |
1548 const gfx::Rect& rect) { | 1576 const gfx::Rect& rect) { |
1549 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(routing_id(), rect)); | 1577 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect)); |
1550 } | 1578 } |
1551 | 1579 |
1552 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, | 1580 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, |
1553 const gfx::Point& end) { | 1581 const gfx::Point& end) { |
1554 Send(new ViewMsg_SelectRange(routing_id(), start, end)); | 1582 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end)); |
1555 } | 1583 } |
1556 | 1584 |
1557 void RenderWidgetHostImpl::Undo() { | 1585 void RenderWidgetHostImpl::Undo() { |
1558 Send(new ViewMsg_Undo(routing_id())); | 1586 Send(new ViewMsg_Undo(GetRoutingID())); |
1559 content::RecordAction(UserMetricsAction("Undo")); | 1587 content::RecordAction(UserMetricsAction("Undo")); |
1560 } | 1588 } |
1561 | 1589 |
1562 void RenderWidgetHostImpl::Redo() { | 1590 void RenderWidgetHostImpl::Redo() { |
1563 Send(new ViewMsg_Redo(routing_id())); | 1591 Send(new ViewMsg_Redo(GetRoutingID())); |
1564 content::RecordAction(UserMetricsAction("Redo")); | 1592 content::RecordAction(UserMetricsAction("Redo")); |
1565 } | 1593 } |
1566 | 1594 |
1567 void RenderWidgetHostImpl::Cut() { | 1595 void RenderWidgetHostImpl::Cut() { |
1568 Send(new ViewMsg_Cut(routing_id())); | 1596 Send(new ViewMsg_Cut(GetRoutingID())); |
1569 content::RecordAction(UserMetricsAction("Cut")); | 1597 content::RecordAction(UserMetricsAction("Cut")); |
1570 } | 1598 } |
1571 | 1599 |
1572 void RenderWidgetHostImpl::Copy() { | 1600 void RenderWidgetHostImpl::Copy() { |
1573 Send(new ViewMsg_Copy(routing_id())); | 1601 Send(new ViewMsg_Copy(GetRoutingID())); |
1574 content::RecordAction(UserMetricsAction("Copy")); | 1602 content::RecordAction(UserMetricsAction("Copy")); |
1575 } | 1603 } |
1576 | 1604 |
1577 void RenderWidgetHostImpl::CopyToFindPboard() { | 1605 void RenderWidgetHostImpl::CopyToFindPboard() { |
1578 #if defined(OS_MACOSX) | 1606 #if defined(OS_MACOSX) |
1579 // Windows/Linux don't have the concept of a find pasteboard. | 1607 // Windows/Linux don't have the concept of a find pasteboard. |
1580 Send(new ViewMsg_CopyToFindPboard(routing_id())); | 1608 Send(new ViewMsg_CopyToFindPboard(GetRoutingID())); |
1581 content::RecordAction(UserMetricsAction("CopyToFindPboard")); | 1609 content::RecordAction(UserMetricsAction("CopyToFindPboard")); |
1582 #endif | 1610 #endif |
1583 } | 1611 } |
1584 | 1612 |
1585 void RenderWidgetHostImpl::Paste() { | 1613 void RenderWidgetHostImpl::Paste() { |
1586 Send(new ViewMsg_Paste(routing_id())); | 1614 Send(new ViewMsg_Paste(GetRoutingID())); |
1587 content::RecordAction(UserMetricsAction("Paste")); | 1615 content::RecordAction(UserMetricsAction("Paste")); |
1588 } | 1616 } |
1589 | 1617 |
1590 void RenderWidgetHostImpl::PasteAndMatchStyle() { | 1618 void RenderWidgetHostImpl::PasteAndMatchStyle() { |
1591 Send(new ViewMsg_PasteAndMatchStyle(routing_id())); | 1619 Send(new ViewMsg_PasteAndMatchStyle(GetRoutingID())); |
1592 content::RecordAction(UserMetricsAction("PasteAndMatchStyle")); | 1620 content::RecordAction(UserMetricsAction("PasteAndMatchStyle")); |
1593 } | 1621 } |
1594 | 1622 |
1595 void RenderWidgetHostImpl::Delete() { | 1623 void RenderWidgetHostImpl::Delete() { |
1596 Send(new ViewMsg_Delete(routing_id())); | 1624 Send(new ViewMsg_Delete(GetRoutingID())); |
1597 content::RecordAction(UserMetricsAction("DeleteSelection")); | 1625 content::RecordAction(UserMetricsAction("DeleteSelection")); |
1598 } | 1626 } |
1599 | 1627 |
1600 void RenderWidgetHostImpl::SelectAll() { | 1628 void RenderWidgetHostImpl::SelectAll() { |
1601 Send(new ViewMsg_SelectAll(routing_id())); | 1629 Send(new ViewMsg_SelectAll(GetRoutingID())); |
1602 content::RecordAction(UserMetricsAction("SelectAll")); | 1630 content::RecordAction(UserMetricsAction("SelectAll")); |
1603 } | 1631 } |
1604 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) { | 1632 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) { |
1605 if (!allowed) { | 1633 if (!allowed) { |
1606 RejectMouseLockOrUnlockIfNecessary(); | 1634 RejectMouseLockOrUnlockIfNecessary(); |
1607 return false; | 1635 return false; |
1608 } else { | 1636 } else { |
1609 if (!pending_mouse_lock_request_) { | 1637 if (!pending_mouse_lock_request_) { |
1610 // This is possible, e.g., the plugin sends us an unlock request before | 1638 // This is possible, e.g., the plugin sends us an unlock request before |
1611 // the user allows to lock to mouse. | 1639 // the user allows to lock to mouse. |
(...skipping 19 matching lines...) Expand all Loading... |
1631 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); | 1659 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); |
1632 } | 1660 } |
1633 | 1661 |
1634 // static | 1662 // static |
1635 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, | 1663 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, |
1636 int gpu_host_id) { | 1664 int gpu_host_id) { |
1637 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); | 1665 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); |
1638 if (ui_shim) | 1666 if (ui_shim) |
1639 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); | 1667 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); |
1640 } | 1668 } |
OLD | NEW |