A bunch of cleanups to beforeunload/unload handling.
1. Remove all the is_closing_browser plumbing. WebContents/TabContents/RenderViewHost/etc really shouldn't (and don't!) need to know anything about whether we're closing the browser or not.
2. Refactor the handling of beforeunload/unload state in browser.cc. I think this makes it considerably easier to reason about the correctness of it.
3. Added a couple TODOs for future cleanups that would have made this change a bit too large.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 28a9195..478efaa 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2425,16 +2425,13 @@
frame_url, data, static_cast<int32>(status)));
}
-void RenderView::OnMsgShouldClose(bool is_closing_browser) {
+void RenderView::OnMsgShouldClose() {
bool should_close = webview()->ShouldClose();
-
- Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close,
- is_closing_browser));
+ Send(new ViewHostMsg_ShouldClose_ACK(routing_id_, should_close));
}
void RenderView::OnClosePage(int new_render_process_host_id,
- int new_request_id,
- bool is_closing_browser) {
+ int new_request_id) {
// TODO(creis): We'd rather use webview()->Close() here, but that currently
// sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs
// in the onunload handler from appearing. For now, we're bypassing that and
@@ -2448,8 +2445,7 @@
Send(new ViewHostMsg_ClosePage_ACK(routing_id_,
new_render_process_host_id,
- new_request_id,
- is_closing_browser));
+ new_request_id));
}
void RenderView::OnThemeChanged() {