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

Unified Diff: content/browser/download/save_package.cc

Issue 10912173: Replace the DownloadFileManager with direct ownership of DownloadFileImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR. Created 8 years, 3 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
Index: content/browser/download/save_package.cc
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index c6b8021e1b9b1b54c32460c4be35d0c93d170dc3..43bdc1e0fa637ce9d7763585c2c8cc3ea07cf417 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -340,10 +340,11 @@ void SavePackage::OnMHTMLGenerated(const FilePath& path, int64 size) {
// with SavePackage flow.
if (download_->IsInProgress()) {
download_->SetTotalBytes(size);
+ download_->UpdateProgress(size, 0, "");
// Must call OnAllDataSaved here in order for
// GDataDownloadObserver::ShouldUpload() to return true.
// ShouldCompleteDownload() may depend on the gdata uploader to finish.
- download_->OnAllDataSaved(size, DownloadItem::kEmptyFileHash);
+ download_->OnAllDataSaved(DownloadItem::kEmptyFileHash);
}
if (!download_manager_->GetDelegate() ||
@@ -747,17 +748,19 @@ void SavePackage::Finish() {
file_manager_,
save_ids));
- // Hack to avoid touching download_ after user cancel.
- // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem
- // with SavePackage flow.
- if (download_ && download_->IsInProgress()) {
- if (save_type_ != content::SAVE_PAGE_TYPE_AS_MHTML) {
- download_->OnAllDataSaved(all_save_items_count_,
- DownloadItem::kEmptyFileHash);
+ if (download_) {
+ // Hack to avoid touching download_ after user cancel.
+ // TODO(rdsmith/benjhayden): Integrate canceling on DownloadItem
+ // with SavePackage flow.
+ if (download_->IsInProgress()) {
+ if (save_type_ != content::SAVE_PAGE_TYPE_AS_MHTML) {
+ download_->UpdateProgress(all_save_items_count_, CurrentSpeed(), "");
+ download_->OnAllDataSaved(DownloadItem::kEmptyFileHash);
+ }
+ download_->MarkAsComplete();
}
- download_->MarkAsComplete();
+ FinalizeDownloadEntry();
}
- FinalizeDownloadEntry();
}
// Called for updating end state.

Powered by Google App Engine
This is Rietveld 408576698