summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 20:40:06 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 20:40:06 +0000
commit69444cc086ef3ddf9aaecb4d6bebcb24687c6977 (patch)
treeedf46ca873f1a736095f86614dbb4abff316f14c /chrome/browser/browser.h
parentedd32342189ef6329e894ff08456a2c565606355 (diff)
downloadchromium_src-69444cc086ef3ddf9aaecb4d6bebcb24687c6977.zip
chromium_src-69444cc086ef3ddf9aaecb4d6bebcb24687c6977.tar.gz
chromium_src-69444cc086ef3ddf9aaecb4d6bebcb24687c6977.tar.bz2
This CL adds a confirmation box when closing the browser with in-progress downloads.
BUG=1028 TEST=Start several bug downloads, close the browser. A dialog shows up to warn you are about to lose the downloads. Try the wait and continue button. Try again with several windows, and in Incognito mode. Review URL: http://codereview.chromium.org/62131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.h')
-rw-r--r--chrome/browser/browser.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 63b28d5..9db95d5 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -187,6 +187,14 @@ class Browser : public TabStripModelDelegate,
// cleanup.
void OnWindowClosing();
+ // In-progress download termination handling /////////////////////////////////
+
+ // Called when the user has decided whether to proceed or not with the browser
+ // closure. |cancel_downloads| is true if the downloads should be canceled
+ // and the browser closed, false if the browser should stay open and the
+ // downloads running.
+ void InProgressDownloadResponse(bool cancel_downloads);
+
// TabStripModel pass-thrus /////////////////////////////////////////////////
TabStripModel* tabstrip_model() const {
@@ -551,6 +559,13 @@ class Browser : public TabStripModelDelegate,
// successfully fired.
void ClearUnloadState(TabContents* tab);
+ // In-progress download termination handling /////////////////////////////////
+
+ // Called when the window is closing to check if potential in-progress
+ // downloads should prevent it from closing.
+ // Returns true if the window can close, false otherwise.
+ bool CanCloseWithInProgressDownloads();
+
// Assorted utility functions ///////////////////////////////////////////////
// Retrieve the last active tabbed browser with the same profile as the
@@ -667,6 +682,19 @@ class Browser : public TabStripModelDelegate,
// in preparation for closing the browser.
bool is_attempting_to_close_browser_;
+ // In-progress download termination handling /////////////////////////////////
+
+ enum CancelDownloadConfirmationState {
+ NOT_PROMPTED, // We have not asked the user.
+ WAITING_FOR_RESPONSE, // We have asked the user and have not received a
+ // reponse yet.
+ RESPONSE_RECEIVED // The user was prompted and made a decision already.
+ };
+
+ // State used to figure-out whether we should prompt the user for confirmation
+ // when the browser is closed with in-progress downloads.
+ CancelDownloadConfirmationState cancel_download_confirmation_state_;
+
/////////////////////////////////////////////////////////////////////////////
// Override values for the bounds of the window and its maximized state.