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

Side by Side Diff: chrome/browser/renderer_host/render_view_host.cc

Issue 256015: Stops the throbber from spinning if the user cancels a beforeunload dialog,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/render_view_host.h" 5 #include "chrome/browser/renderer_host/render_view_host.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 int routing_id) 103 int routing_id)
104 : RenderWidgetHost(instance->GetProcess(), routing_id), 104 : RenderWidgetHost(instance->GetProcess(), routing_id),
105 instance_(instance), 105 instance_(instance),
106 delegate_(delegate), 106 delegate_(delegate),
107 waiting_for_drag_context_response_(false), 107 waiting_for_drag_context_response_(false),
108 enabled_bindings_(0), 108 enabled_bindings_(0),
109 pending_request_id_(0), 109 pending_request_id_(0),
110 navigations_suspended_(false), 110 navigations_suspended_(false),
111 suspended_nav_message_(NULL), 111 suspended_nav_message_(NULL),
112 run_modal_reply_msg_(NULL), 112 run_modal_reply_msg_(NULL),
113 is_showing_before_unload_dialog_(false),
113 is_waiting_for_unload_ack_(false), 114 is_waiting_for_unload_ack_(false),
114 unload_ack_is_for_cross_site_transition_(false), 115 unload_ack_is_for_cross_site_transition_(false),
115 are_javascript_messages_suppressed_(false), 116 are_javascript_messages_suppressed_(false),
116 sudden_termination_allowed_(false), 117 sudden_termination_allowed_(false),
117 in_inspect_element_mode_(false) { 118 in_inspect_element_mode_(false) {
118 DCHECK(instance_); 119 DCHECK(instance_);
119 DCHECK(delegate_); 120 DCHECK(delegate_);
120 121
121 // TODO(mpcomplete): remove this notification (and registrar) when we figure 122 // TODO(mpcomplete): remove this notification (and registrar) when we figure
122 // out why we're crashing on process()->Init(). 123 // out why we're crashing on process()->Init().
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 process()->set_ignore_input_events(false); 572 process()->set_ignore_input_events(false);
572 if (is_waiting_for_unload_ack_) { 573 if (is_waiting_for_unload_ack_) {
573 if (are_javascript_messages_suppressed_) { 574 if (are_javascript_messages_suppressed_) {
574 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_); 575 delegate_->RendererUnresponsive(this, is_waiting_for_unload_ack_);
575 return; 576 return;
576 } 577 }
577 578
578 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 579 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
579 } 580 }
580 581
582 if (is_showing_before_unload_dialog_ && !success) {
583 // If a beforeunload dialog is canceled, we need to stop the throbber from
584 // spinning, since we forced it to start spinning in Navigate.
585 delegate_->DidStopLoading(this);
586 }
587 is_showing_before_unload_dialog_ = false;
588
581 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, 589 ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg,
582 success, prompt); 590 success, prompt);
583 Send(reply_msg); 591 Send(reply_msg);
584 } 592 }
585 593
586 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg, 594 void RenderViewHost::ModalHTMLDialogClosed(IPC::Message* reply_msg,
587 const std::string& json_retval) { 595 const std::string& json_retval) {
588 if (is_waiting_for_unload_ack_) 596 if (is_waiting_for_unload_ack_)
589 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS)); 597 StartHangMonitorTimeout(TimeDelta::FromMilliseconds(kUnloadTimeoutMS));
590 598
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 &are_javascript_messages_suppressed_); 1302 &are_javascript_messages_suppressed_);
1295 } 1303 }
1296 1304
1297 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url, 1305 void RenderViewHost::OnMsgRunBeforeUnloadConfirm(const GURL& frame_url,
1298 const std::wstring& message, 1306 const std::wstring& message,
1299 IPC::Message* reply_msg) { 1307 IPC::Message* reply_msg) {
1300 // While a JS before unload dialog is showing, tabs in the same process 1308 // While a JS before unload dialog is showing, tabs in the same process
1301 // shouldn't process input events. 1309 // shouldn't process input events.
1302 process()->set_ignore_input_events(true); 1310 process()->set_ignore_input_events(true);
1303 StopHangMonitorTimeout(); 1311 StopHangMonitorTimeout();
1312 is_showing_before_unload_dialog_ = true;
1304 delegate_->RunBeforeUnloadConfirm(message, reply_msg); 1313 delegate_->RunBeforeUnloadConfirm(message, reply_msg);
1305 } 1314 }
1306 1315
1307 void RenderViewHost::OnMsgShowModalHTMLDialog( 1316 void RenderViewHost::OnMsgShowModalHTMLDialog(
1308 const GURL& url, int width, int height, const std::string& json_arguments, 1317 const GURL& url, int width, int height, const std::string& json_arguments,
1309 IPC::Message* reply_msg) { 1318 IPC::Message* reply_msg) {
1310 StopHangMonitorTimeout(); 1319 StopHangMonitorTimeout();
1311 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg); 1320 delegate_->ShowModalHTMLDialog(url, width, height, json_arguments, reply_msg);
1312 } 1321 }
1313 1322
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 #endif 1673 #endif
1665 } 1674 }
1666 1675
1667 void RenderViewHost::OnCSSInserted() { 1676 void RenderViewHost::OnCSSInserted() {
1668 delegate_->DidInsertCSS(); 1677 delegate_->DidInsertCSS();
1669 } 1678 }
1670 1679
1671 void RenderViewHost::UpdateBrowserWindowId(int window_id) { 1680 void RenderViewHost::UpdateBrowserWindowId(int window_id) {
1672 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id)); 1681 Send(new ViewMsg_UpdateBrowserWindowId(routing_id(), window_id));
1673 } 1682 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_view_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698