summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 16:30:38 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-30 16:30:38 +0000
commit1cfe52b37f422bc5305e3f0a9c0172990312549e (patch)
tree58e2b1f4da34ec397742e11ec6eec7918bee3485 /chrome/browser/browser.cc
parent73051608c0061b57718841e9c0050ffe5e07c49b (diff)
downloadchromium_src-1cfe52b37f422bc5305e3f0a9c0172990312549e.zip
chromium_src-1cfe52b37f422bc5305e3f0a9c0172990312549e.tar.gz
chromium_src-1cfe52b37f422bc5305e3f0a9c0172990312549e.tar.bz2
Closing the last tab with a download in-progress would cause the tab to be
closed and become unusable if the user decides not to proceed with the browser shutdown. This is because we check for in-progress downloads when the browser is closed, and the tab is closed before that, leaving the tab-strip in a bad state. This CL ensures we also bring-up the confirmation dialog when the last tab is closed. BUG=10680 TEST=Start downloading a big file. While the file is downloading, close all tabs. When closing the last tab, the in-progress download dialog should be shown. Select the 'Wait for downloads', the download tab should be shown and the previous tab should still be displayed and functional. Close all tabs again, this time select the 'Close and cancel downloads' option, the browser should be closed. Review URL: http://codereview.chromium.org/99195 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r--chrome/browser/browser.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index f931187..dc86bcb 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1525,6 +1525,15 @@ bool Browser::RunUnloadListenerBeforeClosing(TabContents* contents) {
return false;
}
+bool Browser::CanCloseContentsAt(int index) {
+ if (tabstrip_model_.count() > 1)
+ return true;
+ // We are closing the last tab for this browser. Make sure to check for
+ // in-progress downloads.
+ // Note that the next call when it returns false will ask the user for
+ // confirmation before closing the browser if the user decides so.
+ return CanCloseWithInProgressDownloads();
+}
///////////////////////////////////////////////////////////////////////////////
// Browser, TabStripModelObserver implementation: