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

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

Powered by Google App Engine
This is Rietveld 408576698