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

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

Issue 964583002: Remove showModalDialog (Chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 hidden), 186 hidden),
187 frames_ref_count_(0), 187 frames_ref_count_(0),
188 delegate_(delegate), 188 delegate_(delegate),
189 instance_(static_cast<SiteInstanceImpl*>(instance)), 189 instance_(static_cast<SiteInstanceImpl*>(instance)),
190 waiting_for_drag_context_response_(false), 190 waiting_for_drag_context_response_(false),
191 enabled_bindings_(0), 191 enabled_bindings_(0),
192 page_id_(-1), 192 page_id_(-1),
193 is_active_(!swapped_out), 193 is_active_(!swapped_out),
194 is_swapped_out_(swapped_out), 194 is_swapped_out_(swapped_out),
195 main_frame_routing_id_(main_frame_routing_id), 195 main_frame_routing_id_(main_frame_routing_id),
196 run_modal_reply_msg_(NULL),
197 run_modal_opener_id_(MSG_ROUTING_NONE),
198 is_waiting_for_close_ack_(false), 196 is_waiting_for_close_ack_(false),
199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 197 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
200 virtual_keyboard_requested_(false), 198 virtual_keyboard_requested_(false),
201 is_focused_element_editable_(false), 199 is_focused_element_editable_(false),
202 updating_web_preferences_(false), 200 updating_web_preferences_(false),
203 weak_factory_(this) { 201 weak_factory_(this) {
204 DCHECK(instance_.get()); 202 DCHECK(instance_.get());
205 CHECK(delegate_); // http://crbug.com/82827 203 CHECK(delegate_); // http://crbug.com/82827
206 204
207 GetProcess()->EnableSendQueue(); 205 GetProcess()->EnableSendQueue();
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 if (delegate_->OnMessageReceived(this, msg)) 855 if (delegate_->OnMessageReceived(this, msg))
858 return true; 856 return true;
859 857
860 bool handled = true; 858 bool handled = true;
861 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg) 859 IPC_BEGIN_MESSAGE_MAP(RenderViewHostImpl, msg)
862 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone) 860 IPC_MESSAGE_HANDLER(FrameHostMsg_RenderProcessGone, OnRenderProcessGone)
863 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView) 861 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowView, OnShowView)
864 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget) 862 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
865 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget, 863 IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget,
866 OnShowFullscreenWidget) 864 OnShowFullscreenWidget)
867 IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal)
868 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) 865 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady)
869 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState) 866 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState)
870 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL) 867 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateTargetURL, OnUpdateTargetURL)
871 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose) 868 IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnClose)
872 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove) 869 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnRequestMove)
873 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame, 870 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentAvailableInMainFrame,
874 OnDocumentAvailableInMainFrame) 871 OnDocumentAvailableInMainFrame)
875 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange, 872 IPC_MESSAGE_HANDLER(ViewHostMsg_DidContentsPreferredSizeChange,
876 OnDidContentsPreferredSizeChange) 873 OnDidContentsPreferredSizeChange)
877 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent, 874 IPC_MESSAGE_HANDLER(ViewHostMsg_RouteCloseEvent,
(...skipping 13 matching lines...) Expand all
891 handled = RenderWidgetHostImpl::OnMessageReceived(msg)) 888 handled = RenderWidgetHostImpl::OnMessageReceived(msg))
892 IPC_END_MESSAGE_MAP() 889 IPC_END_MESSAGE_MAP()
893 890
894 return handled; 891 return handled;
895 } 892 }
896 893
897 void RenderViewHostImpl::Init() { 894 void RenderViewHostImpl::Init() {
898 RenderWidgetHostImpl::Init(); 895 RenderWidgetHostImpl::Init();
899 } 896 }
900 897
901 void RenderViewHostImpl::Shutdown() {
902 // If we are being run modally (see RunModal), then we need to cleanup.
903 if (run_modal_reply_msg_) {
904 Send(run_modal_reply_msg_);
905 run_modal_reply_msg_ = NULL;
906 RenderViewHostImpl* opener =
907 RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_);
908 if (opener) {
909 opener->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(
910 hung_renderer_delay_ms_));
911 // Balance out the decrement when we got created.
912 opener->increment_in_flight_event_count();
913 }
914 run_modal_opener_id_ = MSG_ROUTING_NONE;
915 }
916
917 // We can't release the SessionStorageNamespace until our peer
jam 2015/02/26 21:40:36 why remove this code?
918 // in the renderer has wound down.
919 if (GetProcess()->HasConnection()) {
920 RenderProcessHostImpl::ReleaseOnCloseACK(
921 GetProcess(),
922 delegate_->GetSessionStorageNamespaceMap(),
923 GetRoutingID());
924 }
925
926 RenderWidgetHostImpl::Shutdown();
927 }
928
929 void RenderViewHostImpl::WasHidden() { 898 void RenderViewHostImpl::WasHidden() {
930 if (ResourceDispatcherHostImpl::Get()) { 899 if (ResourceDispatcherHostImpl::Get()) {
931 BrowserThread::PostTask( 900 BrowserThread::PostTask(
932 BrowserThread::IO, FROM_HERE, 901 BrowserThread::IO, FROM_HERE,
933 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostWasHidden, 902 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostWasHidden,
934 base::Unretained(ResourceDispatcherHostImpl::Get()), 903 base::Unretained(ResourceDispatcherHostImpl::Get()),
935 GetProcess()->GetID(), GetRoutingID())); 904 GetProcess()->GetID(), GetRoutingID()));
936 } 905 }
937 906
938 RenderWidgetHostImpl::WasHidden(); 907 RenderWidgetHostImpl::WasHidden();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 delegate_->ShowCreatedWidget(route_id, initial_rect); 964 delegate_->ShowCreatedWidget(route_id, initial_rect);
996 Send(new ViewMsg_Move_ACK(route_id)); 965 Send(new ViewMsg_Move_ACK(route_id));
997 } 966 }
998 967
999 void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) { 968 void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) {
1000 if (is_active_) 969 if (is_active_)
1001 delegate_->ShowCreatedFullscreenWidget(route_id); 970 delegate_->ShowCreatedFullscreenWidget(route_id);
1002 Send(new ViewMsg_Move_ACK(route_id)); 971 Send(new ViewMsg_Move_ACK(route_id));
1003 } 972 }
1004 973
1005 void RenderViewHostImpl::OnRunModal(int opener_id, IPC::Message* reply_msg) {
1006 DCHECK(!run_modal_reply_msg_);
1007 run_modal_reply_msg_ = reply_msg;
1008 run_modal_opener_id_ = opener_id;
1009
1010 RecordAction(base::UserMetricsAction("ShowModalDialog"));
1011
1012 RenderViewHostImpl* opener =
1013 RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_);
1014 if (opener) {
1015 opener->StopHangMonitorTimeout();
1016 // The ack for the mouse down won't come until the dialog closes, so fake it
1017 // so that we don't get a timeout.
1018 opener->decrement_in_flight_event_count();
1019 }
1020
1021 // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in
1022 // an app-modal fashion.
1023 }
1024
1025 void RenderViewHostImpl::OnRenderViewReady() { 974 void RenderViewHostImpl::OnRenderViewReady() {
1026 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; 975 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING;
1027 SendScreenRects(); 976 SendScreenRects();
1028 WasResized(); 977 WasResized();
1029 delegate_->RenderViewReady(this); 978 delegate_->RenderViewReady(this);
1030 } 979 }
1031 980
1032 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { 981 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) {
1033 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a 982 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a
1034 // RenderViewHostImpl and destroy itself. 983 // RenderViewHostImpl and destroy itself.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 FrameTree* frame_tree = delegate_->GetFrameTree(); 1396 FrameTree* frame_tree = delegate_->GetFrameTree();
1448 1397
1449 frame_tree->ResetForMainFrameSwap(); 1398 frame_tree->ResetForMainFrameSwap();
1450 } 1399 }
1451 1400
1452 void RenderViewHostImpl::SelectWordAroundCaret() { 1401 void RenderViewHostImpl::SelectWordAroundCaret() {
1453 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1402 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1454 } 1403 }
1455 1404
1456 } // namespace content 1405 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698