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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // TODO(darin): what about constrained windows? it doesn't look like they 242 // TODO(darin): what about constrained windows? it doesn't look like they
243 // see a message when their parent is hidden. maybe there is something more 243 // see a message when their parent is hidden. maybe there is something more
244 // generic we can do at the TabContents API level instead of relying on 244 // generic we can do at the TabContents API level instead of relying on
245 // Windows messages. 245 // Windows messages.
246 246
247 // Tell the RenderProcessHost we were hidden. 247 // Tell the RenderProcessHost we were hidden.
248 process_->WidgetHidden(); 248 process_->WidgetHidden();
249 249
250 bool is_visible = false; 250 bool is_visible = false;
251 NotificationService::current()->Notify( 251 NotificationService::current()->Notify(
252 NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, 252 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
253 Source<RenderWidgetHost>(this), 253 Source<RenderWidgetHost>(this),
254 Details<bool>(&is_visible)); 254 Details<bool>(&is_visible));
255 } 255 }
256 256
257 void RenderWidgetHost::WasRestored() { 257 void RenderWidgetHost::WasRestored() {
258 // When we create the widget, it is created as *not* hidden. 258 // When we create the widget, it is created as *not* hidden.
259 if (!is_hidden_) 259 if (!is_hidden_)
260 return; 260 return;
261 is_hidden_ = false; 261 is_hidden_ = false;
262 262
(...skipping 14 matching lines...) Expand all
277 277
278 GpuProcessHost::SendOnIO( 278 GpuProcessHost::SendOnIO(
279 0, 279 0,
280 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH, 280 content::CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH,
281 new GpuMsg_VisibilityChanged(routing_id_, process()->id(), true)); 281 new GpuMsg_VisibilityChanged(routing_id_, process()->id(), true));
282 282
283 process_->WidgetRestored(); 283 process_->WidgetRestored();
284 284
285 bool is_visible = true; 285 bool is_visible = true;
286 NotificationService::current()->Notify( 286 NotificationService::current()->Notify(
287 NotificationType::RENDER_WIDGET_VISIBILITY_CHANGED, 287 content::NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
288 Source<RenderWidgetHost>(this), 288 Source<RenderWidgetHost>(this),
289 Details<bool>(&is_visible)); 289 Details<bool>(&is_visible));
290 290
291 // It's possible for our size to be out of sync with the renderer. The 291 // It's possible for our size to be out of sync with the renderer. The
292 // following is one case that leads to this: 292 // following is one case that leads to this:
293 // 1. WasResized -> Send ViewMsg_Resize to render 293 // 1. WasResized -> Send ViewMsg_Resize to render
294 // 2. WasResized -> do nothing as resize_ack_pending_ is true 294 // 2. WasResized -> do nothing as resize_ack_pending_ is true
295 // 3. WasHidden 295 // 3. WasHidden
296 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view 296 // 4. OnMsgUpdateRect from (1) processed. Does NOT invoke WasResized as view
297 // is hidden. Now renderer/browser out of sync with what they think size 297 // is hidden. Now renderer/browser out of sync with what they think size
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 Send(new ViewMsg_ImeConfirmComposition(routing_id(), string16())); 750 Send(new ViewMsg_ImeConfirmComposition(routing_id(), string16()));
751 } 751 }
752 752
753 void RenderWidgetHost::ImeCancelComposition() { 753 void RenderWidgetHost::ImeCancelComposition() {
754 Send(new ViewMsg_ImeSetComposition(routing_id(), string16(), 754 Send(new ViewMsg_ImeSetComposition(routing_id(), string16(),
755 std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); 755 std::vector<WebKit::WebCompositionUnderline>(), 0, 0));
756 } 756 }
757 757
758 void RenderWidgetHost::Destroy() { 758 void RenderWidgetHost::Destroy() {
759 NotificationService::current()->Notify( 759 NotificationService::current()->Notify(
760 NotificationType::RENDER_WIDGET_HOST_DESTROYED, 760 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
761 Source<RenderWidgetHost>(this), 761 Source<RenderWidgetHost>(this),
762 NotificationService::NoDetails()); 762 NotificationService::NoDetails());
763 763
764 // Tell the view to die. 764 // Tell the view to die.
765 // Note that in the process of the view shutting down, it can call a ton 765 // Note that in the process of the view shutting down, it can call a ton
766 // of other messages on us. So if you do any other deinitialization here, 766 // of other messages on us. So if you do any other deinitialization here,
767 // do it after this call to view_->Destroy(). 767 // do it after this call to view_->Destroy().
768 if (view_) 768 if (view_)
769 view_->Destroy(); 769 view_->Destroy();
770 770
771 delete this; 771 delete this;
772 } 772 }
773 773
774 void RenderWidgetHost::CheckRendererIsUnresponsive() { 774 void RenderWidgetHost::CheckRendererIsUnresponsive() {
775 // If we received a call to StopHangMonitorTimeout. 775 // If we received a call to StopHangMonitorTimeout.
776 if (time_when_considered_hung_.is_null()) 776 if (time_when_considered_hung_.is_null())
777 return; 777 return;
778 778
779 // If we have not waited long enough, then wait some more. 779 // If we have not waited long enough, then wait some more.
780 Time now = Time::Now(); 780 Time now = Time::Now();
781 if (now < time_when_considered_hung_) { 781 if (now < time_when_considered_hung_) {
782 StartHangMonitorTimeout(time_when_considered_hung_ - now); 782 StartHangMonitorTimeout(time_when_considered_hung_ - now);
783 return; 783 return;
784 } 784 }
785 785
786 // OK, looks like we have a hung renderer! 786 // OK, looks like we have a hung renderer!
787 NotificationService::current()->Notify( 787 NotificationService::current()->Notify(
788 NotificationType::RENDERER_PROCESS_HANG, 788 content::NOTIFICATION_RENDERER_PROCESS_HANG,
789 Source<RenderWidgetHost>(this), 789 Source<RenderWidgetHost>(this),
790 NotificationService::NoDetails()); 790 NotificationService::NoDetails());
791 is_unresponsive_ = true; 791 is_unresponsive_ = true;
792 NotifyRendererUnresponsive(); 792 NotifyRendererUnresponsive();
793 } 793 }
794 794
795 void RenderWidgetHost::RendererIsResponsive() { 795 void RenderWidgetHost::RendererIsResponsive() {
796 if (is_unresponsive_) { 796 if (is_unresponsive_) {
797 is_unresponsive_ = false; 797 is_unresponsive_ = false;
798 NotifyRendererResponsive(); 798 NotifyRendererResponsive();
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 if (view_) { 851 if (view_) {
852 view_->SetBounds(pos); 852 view_->SetBounds(pos);
853 Send(new ViewMsg_Move_ACK(routing_id_)); 853 Send(new ViewMsg_Move_ACK(routing_id_));
854 } 854 }
855 } 855 }
856 856
857 void RenderWidgetHost::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) { 857 void RenderWidgetHost::OnMsgPaintAtSizeAck(int tag, const gfx::Size& size) {
858 PaintAtSizeAckDetails details = {tag, size}; 858 PaintAtSizeAckDetails details = {tag, size};
859 gfx::Size size_details = size; 859 gfx::Size size_details = size;
860 NotificationService::current()->Notify( 860 NotificationService::current()->Notify(
861 NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK, 861 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_PAINT_AT_SIZE_ACK,
862 Source<RenderWidgetHost>(this), 862 Source<RenderWidgetHost>(this),
863 Details<PaintAtSizeAckDetails>(&details)); 863 Details<PaintAtSizeAckDetails>(&details));
864 } 864 }
865 865
866 void RenderWidgetHost::OnMsgUpdateRect( 866 void RenderWidgetHost::OnMsgUpdateRect(
867 const ViewHostMsg_UpdateRect_Params& params) { 867 const ViewHostMsg_UpdateRect_Params& params) {
868 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgUpdateRect"); 868 TRACE_EVENT0("renderer_host", "RenderWidgetHost::OnMsgUpdateRect");
869 TimeTicks paint_start = TimeTicks::Now(); 869 TimeTicks paint_start = TimeTicks::Now();
870 870
871 NotificationService::current()->Notify( 871 NotificationService::current()->Notify(
872 NotificationType::RENDER_WIDGET_HOST_WILL_PAINT, 872 content::NOTIFICATION_RENDER_WIDGET_HOST_WILL_PAINT,
873 Source<RenderWidgetHost>(this), 873 Source<RenderWidgetHost>(this),
874 NotificationService::NoDetails()); 874 NotificationService::NoDetails());
875 875
876 // Update our knowledge of the RenderWidget's size. 876 // Update our knowledge of the RenderWidget's size.
877 current_size_ = params.view_size; 877 current_size_ = params.view_size;
878 // Update our knowledge of the RenderWidget's scroll offset. 878 // Update our knowledge of the RenderWidget's scroll offset.
879 last_scroll_offset_ = params.scroll_offset; 879 last_scroll_offset_ = params.scroll_offset;
880 880
881 bool is_resize_ack = 881 bool is_resize_ack =
882 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags); 882 ViewHostMsg_UpdateRect_Flags::is_resize_ack(params.flags);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 // destroyed. 959 // destroyed.
960 if (view_ && !is_accelerated_compositing_active_) { 960 if (view_ && !is_accelerated_compositing_active_) {
961 view_being_painted_ = true; 961 view_being_painted_ = true;
962 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy, 962 view_->DidUpdateBackingStore(params.scroll_rect, params.dx, params.dy,
963 params.copy_rects); 963 params.copy_rects);
964 view_being_painted_ = false; 964 view_being_painted_ = false;
965 } 965 }
966 } 966 }
967 967
968 NotificationService::current()->Notify( 968 NotificationService::current()->Notify(
969 NotificationType::RENDER_WIDGET_HOST_DID_PAINT, 969 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT,
970 Source<RenderWidgetHost>(this), 970 Source<RenderWidgetHost>(this),
971 NotificationService::NoDetails()); 971 NotificationService::NoDetails());
972 972
973 // If we got a resize ack, then perhaps we have another resize to send? 973 // If we got a resize ack, then perhaps we have another resize to send?
974 if (is_resize_ack && view_) { 974 if (is_resize_ack && view_) {
975 // WasResized checks the current size and sends the resize update only 975 // WasResized checks the current size and sends the resize update only
976 // when something was actually changed. 976 // when something was actually changed.
977 WasResized(); 977 WasResized();
978 } 978 }
979 979
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 ProcessKeyboardEventAck(type, processed); 1017 ProcessKeyboardEventAck(type, processed);
1018 } else if (type == WebInputEvent::TouchMove) { 1018 } else if (type == WebInputEvent::TouchMove) {
1019 touch_move_pending_ = false; 1019 touch_move_pending_ = false;
1020 if (touch_event_is_queued_) { 1020 if (touch_event_is_queued_) {
1021 touch_event_is_queued_ = false; 1021 touch_event_is_queued_ = false;
1022 ForwardTouchEvent(queued_touch_event_); 1022 ForwardTouchEvent(queued_touch_event_);
1023 } 1023 }
1024 } 1024 }
1025 // This is used only for testing. 1025 // This is used only for testing.
1026 NotificationService::current()->Notify( 1026 NotificationService::current()->Notify(
1027 NotificationType::RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, 1027 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
1028 Source<RenderWidgetHost>(this), 1028 Source<RenderWidgetHost>(this),
1029 Details<int>(&type)); 1029 Details<int>(&type));
1030 } 1030 }
1031 1031
1032 void RenderWidgetHost::ProcessWheelAck() { 1032 void RenderWidgetHost::ProcessWheelAck() {
1033 mouse_wheel_pending_ = false; 1033 mouse_wheel_pending_ = false;
1034 1034
1035 // Now send the next (coalesced) mouse wheel event. 1035 // Now send the next (coalesced) mouse wheel event.
1036 if (!coalesced_mouse_wheel_events_.empty()) { 1036 if (!coalesced_mouse_wheel_events_.empty()) {
1037 WebMouseWheelEvent next_wheel_event = 1037 WebMouseWheelEvent next_wheel_event =
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 view_->CreatePluginContainer(deferred_plugin_handles_[i]); 1207 view_->CreatePluginContainer(deferred_plugin_handles_[i]);
1208 #endif 1208 #endif
1209 } 1209 }
1210 1210
1211 deferred_plugin_handles_.clear(); 1211 deferred_plugin_handles_.clear();
1212 } 1212 }
1213 1213
1214 void RenderWidgetHost::StartUserGesture() { 1214 void RenderWidgetHost::StartUserGesture() {
1215 OnUserGesture(); 1215 OnUserGesture();
1216 } 1216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698