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

Unified Diff: chrome/browser/download/download_manager.cc

Issue 160627: Fix download cancelling from the save dialog (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager.cc
===================================================================
--- chrome/browser/download/download_manager.cc (revision 22425)
+++ chrome/browser/download/download_manager.cc (working copy)
@@ -966,8 +966,6 @@
return;
DownloadItem* download = it->second;
- CancelDownloadRequest(download->render_process_id(), download->request_id());
-
// Clean up will happen when the history system create callback runs if we
// don't have a valid db_handle yet.
if (download->db_handle() != kUninitializedHandle) {
@@ -975,12 +973,23 @@
UpdateHistoryForDownload(download);
}
+ DownloadCancelledInternal(download_id,
+ download->render_process_id(),
+ download->request_id());
+}
+
+void DownloadManager::DownloadCancelledInternal(int download_id,
+ int render_process_id,
+ int request_id) {
+ // Cancel the network request.
+ CancelDownloadRequest(render_process_id, request_id);
+
// Tell the file manager to cancel the download.
- file_manager_->RemoveDownload(download->id(), this); // On the UI thread
+ file_manager_->RemoveDownload(download_id, this); // On the UI thread
file_loop_->PostTask(FROM_HERE,
NewRunnableMethod(file_manager_,
&DownloadFileManager::CancelDownload,
- download->id()));
+ download_id));
}
void DownloadManager::PauseDownload(int32 download_id, bool pause) {
@@ -1386,9 +1395,9 @@
// The user didn't pick a place to save the file, so need to cancel the
// download that's already in progress to the temporary location.
DownloadCreateInfo* info = reinterpret_cast<DownloadCreateInfo*>(params);
- file_loop_->PostTask(FROM_HERE,
- NewRunnableMethod(file_manager_, &DownloadFileManager::CancelDownload,
- info->download_id));
+ DownloadCancelledInternal(info->download_id,
+ info->render_process_id,
+ info->request_id);
}
void DownloadManager::DeleteDownload(const FilePath& path) {
« no previous file with comments | « chrome/browser/download/download_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698