Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: content/browser/renderer_host/render_widget_host.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for initial review. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return last_event.modifiers == new_event.modifiers && 67 return last_event.modifiers == new_event.modifiers &&
68 last_event.scrollByPage == new_event.scrollByPage && 68 last_event.scrollByPage == new_event.scrollByPage &&
69 last_event.hasPreciseScrollingDeltas 69 last_event.hasPreciseScrollingDeltas
70 == new_event.hasPreciseScrollingDeltas && 70 == new_event.hasPreciseScrollingDeltas &&
71 last_event.phase == new_event.phase && 71 last_event.phase == new_event.phase &&
72 last_event.momentumPhase == new_event.momentumPhase; 72 last_event.momentumPhase == new_event.momentumPhase;
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 76
77 RenderWidgetHost::RenderWidgetHost(content::RenderProcessHost* process)
78 : process_(process),
79 view_(NULL) {
80 }
81
82 content::RenderWidgetHostView* RenderWidgetHost::view() const {
83 return view_;
84 }
85
86 // static 77 // static
87 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( 78 RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener(
88 IPC::Channel::Listener* listener) { 79 IPC::Channel::Listener* listener) {
89 return static_cast<RenderWidgetHost*>( 80 return static_cast<RenderWidgetHost*>(
90 static_cast<RenderWidgetHostImpl*>(listener)); 81 static_cast<RenderWidgetHostImpl*>(listener));
91 } 82 }
92 83
93 // static 84 // static
94 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener( 85 const RenderWidgetHost* RenderWidgetHost::FromIPCChannelListener(
95 const IPC::Channel::Listener* listener) { 86 const IPC::Channel::Listener* listener) {
96 return static_cast<const RenderWidgetHost*>( 87 return static_cast<const RenderWidgetHost*>(
97 static_cast<const RenderWidgetHostImpl*>(listener)); 88 static_cast<const RenderWidgetHostImpl*>(listener));
98 } 89 }
99 90
100 /////////////////////////////////////////////////////////////////////////////// 91 ///////////////////////////////////////////////////////////////////////////////
101 // RenderWidgetHostImpl 92 // RenderWidgetHostImpl
102 93
103 RenderWidgetHostImpl::RenderWidgetHostImpl(content::RenderProcessHost* process, 94 RenderWidgetHostImpl::RenderWidgetHostImpl(content::RenderProcessHost* process,
104 int routing_id) 95 int routing_id)
105 : RenderWidgetHost(process), 96 : view_(NULL),
106 renderer_initialized_(false), 97 renderer_initialized_(false),
107 hung_renderer_delay_ms_(kHungRendererDelayMs), 98 hung_renderer_delay_ms_(kHungRendererDelayMs),
99 process_(process),
100 routing_id_(routing_id),
108 renderer_accessible_(false), 101 renderer_accessible_(false),
109 routing_id_(routing_id),
110 surface_id_(0), 102 surface_id_(0),
111 is_loading_(false), 103 is_loading_(false),
112 is_hidden_(false), 104 is_hidden_(false),
113 is_accelerated_compositing_active_(false), 105 is_accelerated_compositing_active_(false),
114 repaint_ack_pending_(false), 106 repaint_ack_pending_(false),
115 resize_ack_pending_(false), 107 resize_ack_pending_(false),
116 should_auto_resize_(false), 108 should_auto_resize_(false),
117 mouse_move_pending_(false), 109 mouse_move_pending_(false),
118 mouse_wheel_pending_(false), 110 mouse_wheel_pending_(false),
119 needs_repainting_on_restore_(false), 111 needs_repainting_on_restore_(false),
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 164
173 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_); 165 GpuSurfaceTracker::Get()->RemoveSurface(surface_id_);
174 surface_id_ = 0; 166 surface_id_ = 0;
175 167
176 process_->Release(routing_id_); 168 process_->Release(routing_id_);
177 } 169 }
178 170
179 // static 171 // static
180 RenderWidgetHostImpl* RenderWidgetHostImpl::FromRWHV( 172 RenderWidgetHostImpl* RenderWidgetHostImpl::FromRWHV(
181 content::RenderWidgetHostView* rwhv) { 173 content::RenderWidgetHostView* rwhv) {
182 return static_cast<RenderWidgetHostImpl*>(rwhv->GetRenderWidgetHost()); 174 return rwhv->GetRenderWidgetHost()->AsRWHImpl();
183 } 175 }
184 176
185 void RenderWidgetHostImpl::SetView(content::RenderWidgetHostView* view) { 177 void RenderWidgetHostImpl::SetView(content::RenderWidgetHostView* view) {
186 view_ = RenderWidgetHostViewPort::FromRWHV(view); 178 view_ = RenderWidgetHostViewPort::FromRWHV(view);
187 179
188 if (!view_) { 180 if (!view_) {
189 GpuSurfaceTracker::Get()->SetSurfaceHandle( 181 GpuSurfaceTracker::Get()->SetSurfaceHandle(
190 surface_id_, gfx::GLSurfaceHandle()); 182 surface_id_, gfx::GLSurfaceHandle());
191 } 183 }
192 } 184 }
193 185
186 content::RenderProcessHost* RenderWidgetHostImpl::GetProcess() const {
187 return process_;
188 }
189
190 int RenderWidgetHostImpl::GetRoutingID() const {
191 return routing_id_;
192 }
193
194 content::RenderWidgetHostView* RenderWidgetHostImpl::GetView() const {
195 return view_;
196 }
197
198 RenderWidgetHostImpl* RenderWidgetHostImpl::AsRWHImpl() {
199 return this;
200 }
201
202 bool RenderWidgetHostImpl::OnMessageReceivedForTesting(
203 const IPC::Message& msg) {
204 return OnMessageReceived(msg);
205 }
206
194 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const { 207 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const {
195 if (view_) 208 if (view_)
196 return view_->GetNativeViewId(); 209 return view_->GetNativeViewId();
197 return 0; 210 return 0;
198 } 211 }
199 212
200 gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() { 213 gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() {
201 if (view_) 214 if (view_)
202 return view_->GetCompositingSurface(); 215 return view_->GetCompositingSurface();
203 return gfx::GLSurfaceHandle(); 216 return gfx::GLSurfaceHandle();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 OnMsgCreatePluginContainer) 303 OnMsgCreatePluginContainer)
291 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, 304 IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer,
292 OnMsgDestroyPluginContainer) 305 OnMsgDestroyPluginContainer)
293 #endif 306 #endif
294 IPC_MESSAGE_UNHANDLED(handled = false) 307 IPC_MESSAGE_UNHANDLED(handled = false)
295 IPC_END_MESSAGE_MAP_EX() 308 IPC_END_MESSAGE_MAP_EX()
296 309
297 if (!msg_is_ok) { 310 if (!msg_is_ok) {
298 // The message de-serialization failed. Kill the renderer process. 311 // The message de-serialization failed. Kill the renderer process.
299 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH")); 312 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH"));
300 process()->ReceivedBadMessage(); 313 GetProcess()->ReceivedBadMessage();
301 } 314 }
302 return handled; 315 return handled;
303 } 316 }
304 317
305 bool RenderWidgetHostImpl::Send(IPC::Message* msg) { 318 bool RenderWidgetHostImpl::Send(IPC::Message* msg) {
306 return process_->Send(msg); 319 return process_->Send(msg);
307 } 320 }
308 321
309 void RenderWidgetHostImpl::WasHidden() { 322 void RenderWidgetHostImpl::WasHidden() {
310 is_hidden_ = true; 323 is_hidden_ = true;
311 324
312 // Don't bother reporting hung state when we aren't the active tab. 325 // Don't bother reporting hung state when we aren't the active tab.
313 StopHangMonitorTimeout(); 326 StopHangMonitorTimeout();
314 327
315 // If we have a renderer, then inform it that we are being hidden so it can 328 // If we have a renderer, then inform it that we are being hidden so it can
316 // reduce its resource utilization. 329 // reduce its resource utilization.
317 Send(new ViewMsg_WasHidden(routing_id_)); 330 Send(new ViewMsg_WasHidden(routing_id_));
318 331
319 // Tell the RenderProcessHost we were hidden. 332 // Tell the RenderProcessHost we were hidden.
320 process_->WidgetHidden(); 333 process_->WidgetHidden();
321 334
322 bool is_visible = false; 335 bool is_visible = false;
323 content::NotificationService::current()->Notify( 336 content::NotificationService::current()->Notify(
324 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 337 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
325 content::Source<RenderWidgetHostImpl>(this), 338 content::Source<RenderWidgetHost>(this),
326 content::Details<bool>(&is_visible)); 339 content::Details<bool>(&is_visible));
327 } 340 }
328 341
329 void RenderWidgetHostImpl::WasRestored() { 342 void RenderWidgetHostImpl::WasRestored() {
330 // When we create the widget, it is created as *not* hidden. 343 // When we create the widget, it is created as *not* hidden.
331 if (!is_hidden_) 344 if (!is_hidden_)
332 return; 345 return;
333 is_hidden_ = false; 346 is_hidden_ = false;
334 347
335 BackingStore* backing_store = BackingStoreManager::Lookup(this); 348 BackingStore* backing_store = BackingStoreManager::Lookup(this);
336 // If we already have a backing store for this widget, then we don't need to 349 // If we already have a backing store for this widget, then we don't need to
337 // repaint on restore _unless_ we know that our backing store is invalid. 350 // repaint on restore _unless_ we know that our backing store is invalid.
338 // When accelerated compositing is on, we must always repaint, even when 351 // When accelerated compositing is on, we must always repaint, even when
339 // the backing store exists. 352 // the backing store exists.
340 bool needs_repainting; 353 bool needs_repainting;
341 if (needs_repainting_on_restore_ || !backing_store || 354 if (needs_repainting_on_restore_ || !backing_store ||
342 is_accelerated_compositing_active()) { 355 is_accelerated_compositing_active()) {
343 needs_repainting = true; 356 needs_repainting = true;
344 needs_repainting_on_restore_ = false; 357 needs_repainting_on_restore_ = false;
345 } else { 358 } else {
346 needs_repainting = false; 359 needs_repainting = false;
347 } 360 }
348 Send(new ViewMsg_WasRestored(routing_id_, needs_repainting)); 361 Send(new ViewMsg_WasRestored(routing_id_, needs_repainting));
349 362
350 process_->WidgetRestored(); 363 process_->WidgetRestored();
351 364
352 bool is_visible = true; 365 bool is_visible = true;
353 content::NotificationService::current()->Notify( 366 content::NotificationService::current()->Notify(
354 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED, 367 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
355 content::Source<RenderWidgetHostImpl>(this), 368 content::Source<RenderWidgetHost>(this),
356 content::Details<bool>(&is_visible)); 369 content::Details<bool>(&is_visible));
357 370
358 // It's possible for our size to be out of sync with the renderer. The 371 // It's possible for our size to be out of sync with the renderer. The
359 // following is one case that leads to this: 372 // following is one case that leads to this:
360 // 1. WasResized -> Send ViewMsg_Resize to render 373 // 1. WasResized -> Send ViewMsg_Resize to render
361 // 2. WasResized -> do nothing as resize_ack_pending_ is true 374 // 2. WasResized -> do nothing as resize_ack_pending_ is true
362 // 3. WasHidden 375 // 3. WasHidden
363 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view 376 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view
364 // is hidden. Now renderer/browser out of sync with what they think size 377 // is hidden. Now renderer/browser out of sync with what they think size
365 // is. 378 // is.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return backing_store; 531 return backing_store;
519 } 532 }
520 533
521 BackingStore* RenderWidgetHostImpl::AllocBackingStore(const gfx::Size& size) { 534 BackingStore* RenderWidgetHostImpl::AllocBackingStore(const gfx::Size& size) {
522 if (!view_) 535 if (!view_)
523 return NULL; 536 return NULL;
524 return view_->AllocBackingStore(size); 537 return view_->AllocBackingStore(size);
525 } 538 }
526 539
527 void RenderWidgetHostImpl::DonePaintingToBackingStore() { 540 void RenderWidgetHostImpl::DonePaintingToBackingStore() {
528 Send(new ViewMsg_UpdateRect_ACK(routing_id())); 541 Send(new ViewMsg_UpdateRect_ACK(GetRoutingID()));
529 } 542 }
530 543
531 void RenderWidgetHostImpl::ScheduleComposite() { 544 void RenderWidgetHostImpl::ScheduleComposite() {
532 if (is_hidden_ || !is_accelerated_compositing_active_) { 545 if (is_hidden_ || !is_accelerated_compositing_active_) {
533 return; 546 return;
534 } 547 }
535 548
536 // Send out a request to the renderer to paint the view if required. 549 // Send out a request to the renderer to paint the view if required.
537 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) { 550 if (!repaint_ack_pending_ && !resize_ack_pending_ && !view_being_painted_) {
538 repaint_start_time_ = TimeTicks::Now(); 551 repaint_start_time_ = TimeTicks::Now();
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 } 829 }
817 830
818 void RenderWidgetHostImpl::CancelUpdateTextDirection() { 831 void RenderWidgetHostImpl::CancelUpdateTextDirection() {
819 if (text_direction_updated_) 832 if (text_direction_updated_)
820 text_direction_canceled_ = true; 833 text_direction_canceled_ = true;
821 } 834 }
822 835
823 void RenderWidgetHostImpl::NotifyTextDirection() { 836 void RenderWidgetHostImpl::NotifyTextDirection() {
824 if (text_direction_updated_) { 837 if (text_direction_updated_) {
825 if (!text_direction_canceled_) 838 if (!text_direction_canceled_)
826 Send(new ViewMsg_SetTextDirection(routing_id(), text_direction_)); 839 Send(new ViewMsg_SetTextDirection(GetRoutingID(), text_direction_));
827 text_direction_updated_ = false; 840 text_direction_updated_ = false;
828 text_direction_canceled_ = false; 841 text_direction_canceled_ = false;
829 } 842 }
830 } 843 }
831 844
832 void RenderWidgetHostImpl::SetInputMethodActive(bool activate) { 845 void RenderWidgetHostImpl::SetInputMethodActive(bool activate) {
833 Send(new ViewMsg_SetInputMethodActive(routing_id(), activate)); 846 Send(new ViewMsg_SetInputMethodActive(GetRoutingID(), activate));
834 } 847 }
835 848
836 void RenderWidgetHostImpl::ImeSetComposition( 849 void RenderWidgetHostImpl::ImeSetComposition(
837 const string16& text, 850 const string16& text,
838 const std::vector<WebKit::WebCompositionUnderline>& underlines, 851 const std::vector<WebKit::WebCompositionUnderline>& underlines,
839 int selection_start, 852 int selection_start,
840 int selection_end) { 853 int selection_end) {
841 Send(new ViewMsg_ImeSetComposition( 854 Send(new ViewMsg_ImeSetComposition(
842 routing_id(), text, underlines, selection_start, selection_end)); 855 GetRoutingID(), text, underlines, selection_start, selection_end));
843 } 856 }
844 857
845 void RenderWidgetHostImpl::ImeConfirmComposition(const string16& text) { 858 void RenderWidgetHostImpl::ImeConfirmComposition(const string16& text) {
846 ImeConfirmComposition(text, ui::Range::InvalidRange()); 859 ImeConfirmComposition(text, ui::Range::InvalidRange());
847 } 860 }
848 861
849 void RenderWidgetHostImpl::ImeConfirmComposition( 862 void RenderWidgetHostImpl::ImeConfirmComposition(
850 const string16& text, const ui::Range& replacement_range) { 863 const string16& text, const ui::Range& replacement_range) {
851 Send(new ViewMsg_ImeConfirmComposition( 864 Send(new ViewMsg_ImeConfirmComposition(
852 routing_id(), text, replacement_range)); 865 GetRoutingID(), text, replacement_range));
853 } 866 }
854 867
855 void RenderWidgetHostImpl::ImeConfirmComposition() { 868 void RenderWidgetHostImpl::ImeConfirmComposition() {
856 ImeConfirmComposition(string16()); 869 ImeConfirmComposition(string16());
857 } 870 }
858 871
859 void RenderWidgetHostImpl::ImeCancelComposition() { 872 void RenderWidgetHostImpl::ImeCancelComposition() {
860 Send(new ViewMsg_ImeSetComposition(routing_id(), string16(), 873 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(),
861 std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); 874 std::vector<WebKit::WebCompositionUnderline>(), 0, 0));
862 } 875 }
863 876
864 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { 877 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const {
865 return gfx::Rect(); 878 return gfx::Rect();
866 } 879 }
867 880
868 void RenderWidgetHostImpl::RequestToLockMouse() { 881 void RenderWidgetHostImpl::RequestToLockMouse() {
869 // Directly reject to lock the mouse. Subclass can override this method to 882 // Directly reject to lock the mouse. Subclass can override this method to
870 // decide whether to allow mouse lock or not. 883 // decide whether to allow mouse lock or not.
(...skipping 28 matching lines...) Expand all
899 DCHECK(enable); 912 DCHECK(enable);
900 913
901 // TODO: Change this to enable instead of true when this supports turning 914 // TODO: Change this to enable instead of true when this supports turning
902 // off auto-resize. 915 // off auto-resize.
903 should_auto_resize_ = true; 916 should_auto_resize_ = true;
904 } 917 }
905 918
906 void RenderWidgetHostImpl::Destroy() { 919 void RenderWidgetHostImpl::Destroy() {
907 content::NotificationService::current()->Notify( 920 content::NotificationService::current()->Notify(
908 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 921 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
909 content::Source<RenderWidgetHostImpl>(this), 922 content::Source<RenderWidgetHost>(this),
910 content::NotificationService::NoDetails()); 923 content::NotificationService::NoDetails());
911 924
912 // Tell the view to die. 925 // Tell the view to die.
913 // Note that in the process of the view shutting down, it can call a ton 926 // Note that in the process of the view shutting down, it can call a ton
914 // of other messages on us. So if you do any other deinitialization here, 927 // of other messages on us. So if you do any other deinitialization here,
915 // do it after this call to view_->Destroy(). 928 // do it after this call to view_->Destroy().
916 if (view_) 929 if (view_)
917 view_->Destroy(); 930 view_->Destroy();
918 931
919 delete this; 932 delete this;
920 } 933 }
921 934
922 void RenderWidgetHostImpl::CheckRendererIsUnresponsive() { 935 void RenderWidgetHostImpl::CheckRendererIsUnresponsive() {
923 // If we received a call to StopHangMonitorTimeout. 936 // If we received a call to StopHangMonitorTimeout.
924 if (time_when_considered_hung_.is_null()) 937 if (time_when_considered_hung_.is_null())
925 return; 938 return;
926 939
927 // If we have not waited long enough, then wait some more. 940 // If we have not waited long enough, then wait some more.
928 Time now = Time::Now(); 941 Time now = Time::Now();
929 if (now < time_when_considered_hung_) { 942 if (now < time_when_considered_hung_) {
930 StartHangMonitorTimeout(time_when_considered_hung_ - now); 943 StartHangMonitorTimeout(time_when_considered_hung_ - now);
931 return; 944 return;
932 } 945 }
933 946
934 // OK, looks like we have a hung renderer! 947 // OK, looks like we have a hung renderer!
935 content::NotificationService::current()->Notify( 948 content::NotificationService::current()->Notify(
936 content::NOTIFICATION_RENDERER_PROCESS_HANG, 949 content::NOTIFICATION_RENDERER_PROCESS_HANG,
937 content::Source<RenderWidgetHostImpl>(this), 950 content::Source<RenderWidgetHost>(this),
938 content::NotificationService::NoDetails()); 951 content::NotificationService::NoDetails());
939 is_unresponsive_ = true; 952 is_unresponsive_ = true;
940 NotifyRendererUnresponsive(); 953 NotifyRendererUnresponsive();
941 } 954 }
942 955
943 void RenderWidgetHostImpl::RendererIsResponsive() { 956 void RenderWidgetHostImpl::RendererIsResponsive() {
944 if (is_unresponsive_) { 957 if (is_unresponsive_) {
945 is_unresponsive_ = false; 958 is_unresponsive_ = false;
946 NotifyRendererResponsive(); 959 NotifyRendererResponsive();
947 } 960 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) { 996 if (text_direction_hint == WebKit::WebTextDirectionLeftToRight) {
984 // Force the tooltip to have LTR directionality. 997 // Force the tooltip to have LTR directionality.
985 wrapped_tooltip_text = 998 wrapped_tooltip_text =
986 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text); 999 base::i18n::GetDisplayStringInLTRDirectionality(wrapped_tooltip_text);
987 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft && 1000 } else if (text_direction_hint == WebKit::WebTextDirectionRightToLeft &&
988 !base::i18n::IsRTL()) { 1001 !base::i18n::IsRTL()) {
989 // Force the tooltip to have RTL directionality. 1002 // Force the tooltip to have RTL directionality.
990 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text); 1003 base::i18n::WrapStringWithRTLFormatting(&wrapped_tooltip_text);
991 } 1004 }
992 } 1005 }
993 if (view()) 1006 if (GetView())
994 view_->SetTooltipText(wrapped_tooltip_text); 1007 view_->SetTooltipText(wrapped_tooltip_text);
995 } 1008 }
996 1009
997 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) { 1010 void RenderWidgetHostImpl::OnMsgRequestMove(const gfx::Rect& pos) {
998 // Note that we ignore the position. 1011 // Note that we ignore the position.
999 if (view_) { 1012 if (view_) {
1000 view_->SetBounds(pos); 1013 view_->SetBounds(pos);
1001 Send(new ViewMsg_Move_ACK(routing_id_)); 1014 Send(new ViewMsg_Move_ACK(routing_id_));
1002 } 1015 }
1003 } 1016 }
1004 1017
1005 void RenderWidgetHostImpl::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { 1018 void RenderWidgetHostImpl::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) {
1006 PaintAtSizeAckDetails details = {tag, size}; 1019 PaintAtSizeAckDetails details = {tag, size};
1007 gfx::Size size_details = size; 1020 gfx::Size size_details = size;
1008 content::NotificationService::current()->Notify( 1021 content::NotificationService::current()->Notify(
1009 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, 1022 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
1010 content::Source<RenderWidgetHostImpl>(this), 1023 content::Source<RenderWidgetHost>(this),
1011 content::Details<PaintAtSizeAckDetails>(&details)); 1024 content::Details<PaintAtSizeAckDetails>(&details));
1012 } 1025 }
1013 1026
1014 void RenderWidgetHostImpl::OnMsgUpdateRect( 1027 void RenderWidgetHostImpl::OnMsgUpdateRect(
1015 const ViewHostMsg_UpdateRect_Params& params) { 1028 const ViewHostMsg_UpdateRect_Params& params) {
1016 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect"); 1029 TRACE_EVENT0("renderer_host", "RenderWidgetHostImpl::OnMsgUpdateRect");
1017 TimeTicks paint_start = TimeTicks::Now(); 1030 TimeTicks paint_start = TimeTicks::Now();
1018 1031
1019 // Update our knowledge of the RenderWidget's size. 1032 // Update our knowledge of the RenderWidget's size.
1020 current_size_ = params.view_size; 1033 current_size_ = params.view_size;
(...skipping 30 matching lines...) Expand all
1051 params.bitmap_rect.width() * 4; 1064 params.bitmap_rect.width() * 4;
1052 TransportDIB* dib = process_->GetTransportDIB(params.bitmap); 1065 TransportDIB* dib = process_->GetTransportDIB(params.bitmap);
1053 1066
1054 // If gpu process does painting, scroll_rect and copy_rects are always empty 1067 // If gpu process does painting, scroll_rect and copy_rects are always empty
1055 // and backing store is never used. 1068 // and backing store is never used.
1056 if (dib) { 1069 if (dib) {
1057 if (dib->size() < size) { 1070 if (dib->size() < size) {
1058 DLOG(WARNING) << "Transport DIB too small for given rectangle"; 1071 DLOG(WARNING) << "Transport DIB too small for given rectangle";
1059 content::RecordAction( 1072 content::RecordAction(
1060 UserMetricsAction("BadMessageTerminate_RWH1")); 1073 UserMetricsAction("BadMessageTerminate_RWH1"));
1061 process()->ReceivedBadMessage(); 1074 GetProcess()->ReceivedBadMessage();
1062 } else { 1075 } else {
1063 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect", 1076 UNSHIPPED_TRACE_EVENT_INSTANT2("test_latency", "UpdateRect",
1064 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(), 1077 "x+y", params.bitmap_rect.x() + params.bitmap_rect.y(),
1065 "color", 0xffffff & *static_cast<uint32*>(dib->memory())); 1078 "color", 0xffffff & *static_cast<uint32*>(dib->memory()));
1066 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth", 1079 UNSHIPPED_TRACE_EVENT_INSTANT1("test_latency", "UpdateRectWidth",
1067 "width", params.bitmap_rect.width()); 1080 "width", params.bitmap_rect.width());
1068 1081
1069 // Scroll the backing store. 1082 // Scroll the backing store.
1070 if (!params.scroll_rect.IsEmpty()) { 1083 if (!params.scroll_rect.IsEmpty()) {
1071 ScrollBackingStoreRect(params.dx, params.dy, 1084 ScrollBackingStoreRect(params.dx, params.dy,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 // Now paint the view. Watch out: it might be destroyed already. 1150 // Now paint the view. Watch out: it might be destroyed already.
1138 if (view_ && !is_accelerated_compositing_active_) { 1151 if (view_ && !is_accelerated_compositing_active_) {
1139 view_being_painted_ = true; 1152 view_being_painted_ = true;
1140 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy, 1153 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy,
1141 params.copy_rects); 1154 params.copy_rects);
1142 view_being_painted_ = false; 1155 view_being_painted_ = false;
1143 } 1156 }
1144 1157
1145 content::NotificationService::current()->Notify( 1158 content::NotificationService::current()->Notify(
1146 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT, 1159 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
1147 content::Source<RenderWidgetHostImpl>(this), 1160 content::Source<RenderWidgetHost>(this),
1148 content::NotificationService::NoDetails()); 1161 content::NotificationService::NoDetails());
1149 1162
1150 // If we got a resize ack, then perhaps we have another resize to send? 1163 // If we got a resize ack, then perhaps we have another resize to send?
1151 bool is_resize_ack = 1164 bool is_resize_ack =
1152 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 1165 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
1153 if (is_resize_ack && view_) { 1166 if (is_resize_ack && view_) {
1154 gfx::Rect view_bounds = view_->GetViewBounds(); 1167 gfx::Rect view_bounds = view_->GetViewBounds();
1155 if (current_size_ != view_bounds.size()) 1168 if (current_size_ != view_bounds.size())
1156 WasResized(); 1169 WasResized();
1157 } 1170 }
(...skipping 22 matching lines...) Expand all
1180 TimeDelta delta = TimeTicks::Now() - input_event_start_time_; 1193 TimeDelta delta = TimeTicks::Now() - input_event_start_time_;
1181 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta); 1194 UMA_HISTOGRAM_TIMES("MPArch.RWH_InputEventDelta", delta);
1182 1195
1183 // Cancel pending hung renderer checks since the renderer is responsive. 1196 // Cancel pending hung renderer checks since the renderer is responsive.
1184 if (--in_flight_event_count_ == 0) 1197 if (--in_flight_event_count_ == 0)
1185 StopHangMonitorTimeout(); 1198 StopHangMonitorTimeout();
1186 1199
1187 int type = static_cast<int>(event_type); 1200 int type = static_cast<int>(event_type);
1188 if (type < WebInputEvent::Undefined) { 1201 if (type < WebInputEvent::Undefined) {
1189 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2")); 1202 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2"));
1190 process()->ReceivedBadMessage(); 1203 GetProcess()->ReceivedBadMessage();
1191 } else if (type == WebInputEvent::MouseMove) { 1204 } else if (type == WebInputEvent::MouseMove) {
1192 mouse_move_pending_ = false; 1205 mouse_move_pending_ = false;
1193 1206
1194 // now, we can send the next mouse move event 1207 // now, we can send the next mouse move event
1195 if (next_mouse_move_.get()) { 1208 if (next_mouse_move_.get()) {
1196 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove); 1209 DCHECK(next_mouse_move_->type == WebInputEvent::MouseMove);
1197 ForwardMouseEvent(*next_mouse_move_); 1210 ForwardMouseEvent(*next_mouse_move_);
1198 } 1211 }
1199 } else if (WebInputEvent::isKeyboardEventType(type)) { 1212 } else if (WebInputEvent::isKeyboardEventType(type)) {
1200 ProcessKeyboardEventAck(type, processed); 1213 ProcessKeyboardEventAck(type, processed);
1201 } else if (type == WebInputEvent::MouseWheel) { 1214 } else if (type == WebInputEvent::MouseWheel) {
1202 ProcessWheelAck(processed); 1215 ProcessWheelAck(processed);
1203 } else if (WebInputEvent::isTouchEventType(type)) { 1216 } else if (WebInputEvent::isTouchEventType(type)) {
1204 ProcessTouchAck(processed); 1217 ProcessTouchAck(processed);
1205 } 1218 }
1206 // This is used only for testing. 1219 // This is used only for testing.
1207 content::NotificationService::current()->Notify( 1220 content::NotificationService::current()->Notify(
1208 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, 1221 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
1209 content::Source<RenderWidgetHostImpl>(this), 1222 content::Source<RenderWidgetHost>(this),
1210 content::Details<int>(&type)); 1223 content::Details<int>(&type));
1211 } 1224 }
1212 1225
1213 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { 1226 void RenderWidgetHostImpl::ProcessWheelAck(bool processed) {
1214 mouse_wheel_pending_ = false; 1227 mouse_wheel_pending_ = false;
1215 1228
1216 // Now send the next (coalesced) mouse wheel event. 1229 // Now send the next (coalesced) mouse wheel event.
1217 if (!coalesced_mouse_wheel_events_.empty()) { 1230 if (!coalesced_mouse_wheel_events_.empty()) {
1218 WebMouseWheelEvent next_wheel_event = 1231 WebMouseWheelEvent next_wheel_event =
1219 coalesced_mouse_wheel_events_.front(); 1232 coalesced_mouse_wheel_events_.front();
1220 coalesced_mouse_wheel_events_.pop_front(); 1233 coalesced_mouse_wheel_events_.pop_front();
1221 ForwardWheelEvent(next_wheel_event); 1234 ForwardWheelEvent(next_wheel_event);
1222 } 1235 }
1223 1236
1224 if (!processed && !is_hidden_ && view_) 1237 if (!processed && !is_hidden_ && view_)
1225 view_->UnhandledWheelEvent(current_wheel_event_); 1238 view_->UnhandledWheelEvent(current_wheel_event_);
1226 } 1239 }
1227 1240
1228 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) { 1241 void RenderWidgetHostImpl::ProcessTouchAck(bool processed) {
1229 if (view_) 1242 if (view_)
1230 view_->ProcessTouchAck(processed); 1243 view_->ProcessTouchAck(processed);
1231 } 1244 }
1232 1245
1233 void RenderWidgetHostImpl::OnMsgFocus() { 1246 void RenderWidgetHostImpl::OnMsgFocus() {
1234 // Only RenderViewHost can deal with that message. 1247 // Only RenderViewHost can deal with that message.
1235 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4")); 1248 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4"));
1236 process()->ReceivedBadMessage(); 1249 GetProcess()->ReceivedBadMessage();
1237 } 1250 }
1238 1251
1239 void RenderWidgetHostImpl::OnMsgBlur() { 1252 void RenderWidgetHostImpl::OnMsgBlur() {
1240 // Only RenderViewHost can deal with that message. 1253 // Only RenderViewHost can deal with that message.
1241 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5")); 1254 content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5"));
1242 process()->ReceivedBadMessage(); 1255 GetProcess()->ReceivedBadMessage();
1243 } 1256 }
1244 1257
1245 void RenderWidgetHostImpl::OnMsgDidChangeNumTouchEvents(int count) { 1258 void RenderWidgetHostImpl::OnMsgDidChangeNumTouchEvents(int count) {
1246 has_touch_handler_ = count > 0; 1259 has_touch_handler_ = count > 0;
1247 } 1260 }
1248 1261
1249 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { 1262 void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) {
1250 if (!view_) { 1263 if (!view_) {
1251 return; 1264 return;
1252 } 1265 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 1396
1384 if (CommandLine::ForCurrentProcess()->HasSwitch( 1397 if (CommandLine::ForCurrentProcess()->HasSwitch(
1385 switches::kDisableRendererAccessibility)) { 1398 switches::kDisableRendererAccessibility)) {
1386 return; 1399 return;
1387 } 1400 }
1388 1401
1389 renderer_accessible_ = true; 1402 renderer_accessible_ = true;
1390 1403
1391 if (process_->HasConnection()) { 1404 if (process_->HasConnection()) {
1392 // Renderer accessibility wasn't enabled on process launch. Enable it now. 1405 // Renderer accessibility wasn't enabled on process launch. Enable it now.
1393 Send(new AccessibilityMsg_Enable(routing_id())); 1406 Send(new AccessibilityMsg_Enable(GetRoutingID()));
1394 } 1407 }
1395 } 1408 }
1396 1409
1410 void RenderWidgetHostImpl::SetIgnoreInputEvents(bool ignore_input_events) {
1411 ignore_input_events_ = ignore_input_events;
1412 }
1413
1397 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) { 1414 void RenderWidgetHostImpl::ProcessKeyboardEventAck(int type, bool processed) {
1398 if (key_queue_.empty()) { 1415 if (key_queue_.empty()) {
1399 LOG(ERROR) << "Got a KeyEvent back from the renderer but we " 1416 LOG(ERROR) << "Got a KeyEvent back from the renderer but we "
1400 << "don't seem to have sent it to the renderer!"; 1417 << "don't seem to have sent it to the renderer!";
1401 } else if (key_queue_.front().type != type) { 1418 } else if (key_queue_.front().type != type) {
1402 LOG(ERROR) << "We seem to have a different key type sent from " 1419 LOG(ERROR) << "We seem to have a different key type sent from "
1403 << "the renderer. (" << key_queue_.front().type << " vs. " 1420 << "the renderer. (" << key_queue_.front().type << " vs. "
1404 << type << "). Ignoring event."; 1421 << type << "). Ignoring event.";
1405 1422
1406 // Something must be wrong. Clear the |key_queue_| and 1423 // Something must be wrong. Clear the |key_queue_| and
(...skipping 30 matching lines...) Expand all
1437 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) { 1454 for (int i = 0; i < static_cast<int>(deferred_plugin_handles_.size()); i++) {
1438 #if defined(TOOLKIT_USES_GTK) 1455 #if defined(TOOLKIT_USES_GTK)
1439 view_->CreatePluginContainer(deferred_plugin_handles_[i]); 1456 view_->CreatePluginContainer(deferred_plugin_handles_[i]);
1440 #endif 1457 #endif
1441 } 1458 }
1442 1459
1443 deferred_plugin_handles_.clear(); 1460 deferred_plugin_handles_.clear();
1444 #endif 1461 #endif
1445 } 1462 }
1446 1463
1464 const gfx::Point& RenderWidgetHostImpl::GetLastScrollOffset() const {
1465 return last_scroll_offset_;
1466 }
1467
1447 void RenderWidgetHostImpl::StartUserGesture() { 1468 void RenderWidgetHostImpl::StartUserGesture() {
1448 OnUserGesture(); 1469 OnUserGesture();
1449 } 1470 }
1450 1471
1451 void RenderWidgetHostImpl::Stop() { 1472 void RenderWidgetHostImpl::Stop() {
1452 Send(new ViewMsg_Stop(routing_id())); 1473 Send(new ViewMsg_Stop(GetRoutingID()));
1453 } 1474 }
1454 1475
1455 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) { 1476 void RenderWidgetHostImpl::SetBackground(const SkBitmap& background) {
1456 Send(new ViewMsg_SetBackground(routing_id(), background)); 1477 Send(new ViewMsg_SetBackground(GetRoutingID(), background));
1457 } 1478 }
1458 1479
1459 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent( 1480 void RenderWidgetHostImpl::SetEditCommandsForNextKeyEvent(
1460 const std::vector<EditCommand>& commands) { 1481 const std::vector<EditCommand>& commands) {
1461 Send(new ViewMsg_SetEditCommandsForNextKeyEvent(routing_id(), commands)); 1482 Send(new ViewMsg_SetEditCommandsForNextKeyEvent(GetRoutingID(), commands));
1462 } 1483 }
1463 1484
1464 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) { 1485 void RenderWidgetHostImpl::AccessibilityDoDefaultAction(int object_id) {
1465 Send(new AccessibilityMsg_DoDefaultAction(routing_id(), object_id)); 1486 Send(new AccessibilityMsg_DoDefaultAction(GetRoutingID(), object_id));
1466 } 1487 }
1467 1488
1468 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { 1489 void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) {
1469 Send(new AccessibilityMsg_SetFocus(routing_id(), object_id)); 1490 Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id));
1470 } 1491 }
1471 1492
1472 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible( 1493 void RenderWidgetHostImpl::AccessibilityScrollToMakeVisible(
1473 int acc_obj_id, gfx::Rect subfocus) { 1494 int acc_obj_id, gfx::Rect subfocus) {
1474 Send(new AccessibilityMsg_ScrollToMakeVisible( 1495 Send(new AccessibilityMsg_ScrollToMakeVisible(
1475 routing_id(), acc_obj_id, subfocus)); 1496 GetRoutingID(), acc_obj_id, subfocus));
1476 } 1497 }
1477 1498
1478 void RenderWidgetHostImpl::AccessibilityScrollToPoint( 1499 void RenderWidgetHostImpl::AccessibilityScrollToPoint(
1479 int acc_obj_id, gfx::Point point) { 1500 int acc_obj_id, gfx::Point point) {
1480 Send(new AccessibilityMsg_ScrollToPoint( 1501 Send(new AccessibilityMsg_ScrollToPoint(
1481 routing_id(), acc_obj_id, point)); 1502 GetRoutingID(), acc_obj_id, point));
1482 } 1503 }
1483 1504
1484 void RenderWidgetHostImpl::AccessibilitySetTextSelection( 1505 void RenderWidgetHostImpl::AccessibilitySetTextSelection(
1485 int object_id, int start_offset, int end_offset) { 1506 int object_id, int start_offset, int end_offset) {
1486 Send(new AccessibilityMsg_SetTextSelection( 1507 Send(new AccessibilityMsg_SetTextSelection(
1487 routing_id(), object_id, start_offset, end_offset)); 1508 GetRoutingID(), object_id, start_offset, end_offset));
1488 } 1509 }
1489 1510
1490 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command, 1511 void RenderWidgetHostImpl::ExecuteEditCommand(const std::string& command,
1491 const std::string& value) { 1512 const std::string& value) {
1492 Send(new ViewMsg_ExecuteEditCommand(routing_id(), command, value)); 1513 Send(new ViewMsg_ExecuteEditCommand(GetRoutingID(), command, value));
1493 } 1514 }
1494 1515
1495 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect( 1516 void RenderWidgetHostImpl::ScrollFocusedEditableNodeIntoRect(
1496 const gfx::Rect& rect) { 1517 const gfx::Rect& rect) {
1497 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(routing_id(), rect)); 1518 Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(GetRoutingID(), rect));
1498 } 1519 }
1499 1520
1500 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start, 1521 void RenderWidgetHostImpl::SelectRange(const gfx::Point& start,
1501 const gfx::Point& end) { 1522 const gfx::Point& end) {
1502 Send(new ViewMsg_SelectRange(routing_id(), start, end)); 1523 Send(new ViewMsg_SelectRange(GetRoutingID(), start, end));
1503 } 1524 }
1504 1525
1505 void RenderWidgetHostImpl::Undo() { 1526 void RenderWidgetHostImpl::Undo() {
1506 Send(new ViewMsg_Undo(routing_id())); 1527 Send(new ViewMsg_Undo(GetRoutingID()));
1507 content::RecordAction(UserMetricsAction("Undo")); 1528 content::RecordAction(UserMetricsAction("Undo"));
1508 } 1529 }
1509 1530
1510 void RenderWidgetHostImpl::Redo() { 1531 void RenderWidgetHostImpl::Redo() {
1511 Send(new ViewMsg_Redo(routing_id())); 1532 Send(new ViewMsg_Redo(GetRoutingID()));
1512 content::RecordAction(UserMetricsAction("Redo")); 1533 content::RecordAction(UserMetricsAction("Redo"));
1513 } 1534 }
1514 1535
1515 void RenderWidgetHostImpl::Cut() { 1536 void RenderWidgetHostImpl::Cut() {
1516 Send(new ViewMsg_Cut(routing_id())); 1537 Send(new ViewMsg_Cut(GetRoutingID()));
1517 content::RecordAction(UserMetricsAction("Cut")); 1538 content::RecordAction(UserMetricsAction("Cut"));
1518 } 1539 }
1519 1540
1520 void RenderWidgetHostImpl::Copy() { 1541 void RenderWidgetHostImpl::Copy() {
1521 Send(new ViewMsg_Copy(routing_id())); 1542 Send(new ViewMsg_Copy(GetRoutingID()));
1522 content::RecordAction(UserMetricsAction("Copy")); 1543 content::RecordAction(UserMetricsAction("Copy"));
1523 } 1544 }
1524 1545
1525 void RenderWidgetHostImpl::CopyToFindPboard() { 1546 void RenderWidgetHostImpl::CopyToFindPboard() {
1526 #if defined(OS_MACOSX) 1547 #if defined(OS_MACOSX)
1527 // Windows/Linux don't have the concept of a find pasteboard. 1548 // Windows/Linux don't have the concept of a find pasteboard.
1528 Send(new ViewMsg_CopyToFindPboard(routing_id())); 1549 Send(new ViewMsg_CopyToFindPboard(GetRoutingID()));
1529 content::RecordAction(UserMetricsAction("CopyToFindPboard")); 1550 content::RecordAction(UserMetricsAction("CopyToFindPboard"));
1530 #endif 1551 #endif
1531 } 1552 }
1532 1553
1533 void RenderWidgetHostImpl::Paste() { 1554 void RenderWidgetHostImpl::Paste() {
1534 Send(new ViewMsg_Paste(routing_id())); 1555 Send(new ViewMsg_Paste(GetRoutingID()));
1535 content::RecordAction(UserMetricsAction("Paste")); 1556 content::RecordAction(UserMetricsAction("Paste"));
1536 } 1557 }
1537 1558
1538 void RenderWidgetHostImpl::PasteAndMatchStyle() { 1559 void RenderWidgetHostImpl::PasteAndMatchStyle() {
1539 Send(new ViewMsg_PasteAndMatchStyle(routing_id())); 1560 Send(new ViewMsg_PasteAndMatchStyle(GetRoutingID()));
1540 content::RecordAction(UserMetricsAction("PasteAndMatchStyle")); 1561 content::RecordAction(UserMetricsAction("PasteAndMatchStyle"));
1541 } 1562 }
1542 1563
1543 void RenderWidgetHostImpl::Delete() { 1564 void RenderWidgetHostImpl::Delete() {
1544 Send(new ViewMsg_Delete(routing_id())); 1565 Send(new ViewMsg_Delete(GetRoutingID()));
1545 content::RecordAction(UserMetricsAction("DeleteSelection")); 1566 content::RecordAction(UserMetricsAction("DeleteSelection"));
1546 } 1567 }
1547 1568
1548 void RenderWidgetHostImpl::SelectAll() { 1569 void RenderWidgetHostImpl::SelectAll() {
1549 Send(new ViewMsg_SelectAll(routing_id())); 1570 Send(new ViewMsg_SelectAll(GetRoutingID()));
1550 content::RecordAction(UserMetricsAction("SelectAll")); 1571 content::RecordAction(UserMetricsAction("SelectAll"));
1551 } 1572 }
1552 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) { 1573 bool RenderWidgetHostImpl::GotResponseToLockMouseRequest(bool allowed) {
1553 if (!allowed) { 1574 if (!allowed) {
1554 RejectMouseLockOrUnlockIfNecessary(); 1575 RejectMouseLockOrUnlockIfNecessary();
1555 return false; 1576 return false;
1556 } else { 1577 } else {
1557 if (!pending_mouse_lock_request_) { 1578 if (!pending_mouse_lock_request_) {
1558 // This is possible, e.g., the plugin sends us an unlock request before 1579 // This is possible, e.g., the plugin sends us an unlock request before
1559 // the user allows to lock to mouse. 1580 // the user allows to lock to mouse.
(...skipping 19 matching lines...) Expand all
1579 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id)); 1600 ui_shim->Send(new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
1580 } 1601 }
1581 1602
1582 // static 1603 // static
1583 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id, 1604 void RenderWidgetHostImpl::AcknowledgePostSubBuffer(int32 route_id,
1584 int gpu_host_id) { 1605 int gpu_host_id) {
1585 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); 1606 GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id);
1586 if (ui_shim) 1607 if (ui_shim)
1587 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id)); 1608 ui_shim->Send(new AcceleratedSurfaceMsg_PostSubBufferACK(route_id));
1588 } 1609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698