summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 09:15:59 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-21 09:15:59 +0000
commitec4826a74de56b6f7a26b3cbad1f7a4713b5dda2 (patch)
tree14e867d4330b82e245339f64d5996dc736e63dba /chrome
parente275e3461a11dd5e325be3a7788ca7258eb7a6ea (diff)
downloadchromium_src-ec4826a74de56b6f7a26b3cbad1f7a4713b5dda2.zip
chromium_src-ec4826a74de56b6f7a26b3cbad1f7a4713b5dda2.tar.gz
chromium_src-ec4826a74de56b6f7a26b3cbad1f7a4713b5dda2.tar.bz2
Regression fix: keep the download shelf visible when multiple sites are saved.
BUG=54149 TEST=see bug Review URL: http://codereview.chromium.org/3442003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60034 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/download/download_manager.cc6
-rw-r--r--chrome/browser/download/download_manager.h7
-rw-r--r--chrome/browser/download/save_package.cc11
3 files changed, 16 insertions, 8 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 16820a2..ef9fbe5 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -127,6 +127,8 @@ void DownloadManager::Shutdown() {
in_progress_.clear();
dangerous_finished_.clear();
STLDeleteValues(&downloads_);
+ STLDeleteContainerPointers(save_page_downloads_.begin(),
+ save_page_downloads_.end());
file_manager_ = NULL;
@@ -787,6 +789,10 @@ int DownloadManager::RemoveAllDownloads() {
return RemoveDownloadsBetween(base::Time(), base::Time());
}
+void DownloadManager::SavePageAsDownloadStarted(DownloadItem* download_item) {
+ save_page_downloads_.push_back(download_item);
+}
+
// Initiate a download of a specific URL. We send the request to the
// ResourceDispatcherHost, and let it send us responses like a regular
// download.
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
index cb864ae..f4dc78d 100644
--- a/chrome/browser/download/download_manager.h
+++ b/chrome/browser/download/download_manager.h
@@ -135,6 +135,9 @@ class DownloadManager
// deleted is returned back to the caller.
int RemoveAllDownloads();
+ // Called when a Save Page As download is started.
+ void SavePageAsDownloadStarted(DownloadItem* download_item);
+
// Download the object at the URL. Used in cases such as "Save Link As..."
void DownloadUrl(const GURL& url,
const GURL& referrer,
@@ -307,6 +310,10 @@ class DownloadManager
DownloadMap in_progress_;
DownloadMap dangerous_finished_;
+ // Collection of all save-page-as downloads in this profile.
+ // It owns the DownloadItems.
+ std::vector<DownloadItem*> save_page_downloads_;
+
// True if the download manager has been initialized and requires a shutdown.
bool shutdown_needed_;
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 42003fa..9953a4c 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -301,14 +301,9 @@ SavePackage::~SavePackage() {
STLDeleteValues(&in_progress_items_);
STLDeleteValues(&saved_failed_items_);
- if (download_) {
- // We call this to remove the view from the shelf. It will invoke
- // DownloadManager::RemoveDownload, but since the fake DownloadItem is not
- // owned by DownloadManager, it will do nothing to our fake item.
- download_->Remove(false);
- delete download_;
- download_ = NULL;
- }
+ // The DownloadItem is owned by DownloadManager.
+ download_ = NULL;
+
file_manager_ = NULL;
// If there's an outstanding save dialog, make sure it doesn't call us back