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

Unified Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 201153003: Revert 252883 "Remove tests and code for showModalDialog" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index fc076b9a8b94c6efe95943c4d10831bbfdd3f220..41dfe0f93868cfd8f955fc76cddb9ccb0cc94f13 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -205,6 +205,8 @@ RenderViewHostImpl::RenderViewHostImpl(
navigations_suspended_(false),
has_accessed_initial_document_(false),
main_frame_routing_id_(main_frame_routing_id),
+ run_modal_reply_msg_(NULL),
+ run_modal_opener_id_(MSG_ROUTING_NONE),
is_waiting_for_beforeunload_ack_(false),
unload_ack_is_for_cross_site_transition_(false),
are_javascript_messages_suppressed_(false),
@@ -1078,6 +1080,7 @@ bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowWidget, OnShowWidget)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowFullscreenWidget,
OnShowFullscreenWidget)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunModal, OnRunModal)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady)
IPC_MESSAGE_HANDLER(ViewHostMsg_RenderProcessGone, OnRenderProcessGone)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateState, OnUpdateState)
@@ -1161,6 +1164,25 @@ void RenderViewHostImpl::Init() {
RenderWidgetHostImpl::Init();
}
+void RenderViewHostImpl::Shutdown() {
+ // If we are being run modally (see RunModal), then we need to cleanup.
+ if (run_modal_reply_msg_) {
+ Send(run_modal_reply_msg_);
+ run_modal_reply_msg_ = NULL;
+ RenderViewHostImpl* opener =
+ RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_);
+ if (opener) {
+ opener->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(
+ hung_renderer_delay_ms_));
+ // Balance out the decrement when we got created.
+ opener->increment_in_flight_event_count();
+ }
+ run_modal_opener_id_ = MSG_ROUTING_NONE;
+ }
+
+ RenderWidgetHostImpl::Shutdown();
+}
+
bool RenderViewHostImpl::IsRenderView() const {
return true;
}
@@ -1213,6 +1235,26 @@ void RenderViewHostImpl::OnShowFullscreenWidget(int route_id) {
Send(new ViewMsg_Move_ACK(route_id));
}
+void RenderViewHostImpl::OnRunModal(int opener_id, IPC::Message* reply_msg) {
+ DCHECK(!run_modal_reply_msg_);
+ run_modal_reply_msg_ = reply_msg;
+ run_modal_opener_id_ = opener_id;
+
+ RecordAction(base::UserMetricsAction("ShowModalDialog"));
+
+ RenderViewHostImpl* opener =
+ RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_);
+ if (opener) {
+ opener->StopHangMonitorTimeout();
+ // The ack for the mouse down won't come until the dialog closes, so fake it
+ // so that we don't get a timeout.
+ opener->decrement_in_flight_event_count();
+ }
+
+ // TODO(darin): Bug 1107929: Need to inform our delegate to show this view in
+ // an app-modal fashion.
+}
+
void RenderViewHostImpl::OnRenderViewReady() {
render_view_termination_status_ = base::TERMINATION_STATUS_STILL_RUNNING;
SendScreenRects();
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698