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

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: updates 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
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
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() { 898 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 899 // We can't release the SessionStorageNamespace until our peer
918 // in the renderer has wound down. 900 // in the renderer has wound down.
919 if (GetProcess()->HasConnection()) { 901 if (GetProcess()->HasConnection()) {
920 RenderProcessHostImpl::ReleaseOnCloseACK( 902 RenderProcessHostImpl::ReleaseOnCloseACK(
921 GetProcess(), 903 GetProcess(),
922 delegate_->GetSessionStorageNamespaceMap(), 904 delegate_->GetSessionStorageNamespaceMap(),
923 GetRoutingID()); 905 GetRoutingID());
924 } 906 }
925 907
926 RenderWidgetHostImpl::Shutdown(); 908 RenderWidgetHostImpl::Shutdown();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 delegate_->ShowCreatedWidget(route_id, initial_rect); 977 delegate_->ShowCreatedWidget(route_id, initial_rect);
996 Send(new ViewMsg_Move_ACK(route_id)); 978 Send(new ViewMsg_Move_ACK(route_id));
997 } 979 }
998 980
999 void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) { 981 void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) {
1000 if (is_active_) 982 if (is_active_)
1001 delegate_->ShowCreatedFullscreenWidget(route_id); 983 delegate_->ShowCreatedFullscreenWidget(route_id);
1002 Send(new ViewMsg_Move_ACK(route_id)); 984 Send(new ViewMsg_Move_ACK(route_id));
1003 } 985 }
1004 986
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() { 987 void RenderViewHostImpl::OnRenderViewReady() {
1026 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING; 988 render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING;
1027 SendScreenRects(); 989 SendScreenRects();
1028 WasResized(); 990 WasResized();
1029 delegate_->RenderViewReady(this); 991 delegate_->RenderViewReady(this);
1030 } 992 }
1031 993
1032 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) { 994 void RenderViewHostImpl::OnRenderProcessGone(int status, int exit_code) {
1033 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a 995 // Do nothing, otherwise RenderWidgetHostImpl will assume it is not a
1034 // RenderViewHostImpl and destroy itself. 996 // RenderViewHostImpl and destroy itself.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 FrameTree* frame_tree = delegate_->GetFrameTree(); 1409 FrameTree* frame_tree = delegate_->GetFrameTree();
1448 1410
1449 frame_tree->ResetForMainFrameSwap(); 1411 frame_tree->ResetForMainFrameSwap();
1450 } 1412 }
1451 1413
1452 void RenderViewHostImpl::SelectWordAroundCaret() { 1414 void RenderViewHostImpl::SelectWordAroundCaret() {
1453 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1415 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1454 } 1416 }
1455 1417
1456 } // namespace content 1418 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698