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

Unified Diff: chrome/browser/chromeos/gdata/gdata_download_observer.cc

Issue 10069014: Save Page As MHTML (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 8 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/about_flags.cc ('k') | chrome/browser/download/chrome_download_manager_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_download_observer.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_download_observer.cc b/chrome/browser/chromeos/gdata/gdata_download_observer.cc
index 3cb89fb37a46dfe357cda973f292628911e1781d..b566a009a4a64278e5de1fce5b393a4291bebe61 100644
--- a/chrome/browser/chromeos/gdata/gdata_download_observer.cc
+++ b/chrome/browser/chromeos/gdata/gdata_download_observer.cc
@@ -133,7 +133,7 @@ bool GDataDownloadObserver::IsReadyToComplete(DownloadItem* download) {
// 2. The upload has completed.
UploadingExternalData* upload_data = GetUploadingExternalData(download);
return !IsGDataDownload(download) ||
- (upload_data && upload_data->is_complete());
+ (upload_data && upload_data->is_complete());
}
// static
@@ -291,10 +291,10 @@ bool GDataDownloadObserver::ShouldUpload(DownloadItem* download) {
// Upload if the item is in pending_downloads_,
// is complete or large enough to stream, and,
// is not already being uploaded.
- return pending_downloads_.count(download->GetId()) != 0 &&
+ return (pending_downloads_.count(download->GetId()) != 0) &&
(download->AllDataSaved() ||
download->GetReceivedBytes() > kStreamingFileSize) &&
- GetUploadingExternalData(download) == NULL;
+ (GetUploadingExternalData(download) == NULL);
}
scoped_ptr<UploadFileInfo> GDataDownloadObserver::CreateUploadFileInfo(
@@ -340,6 +340,14 @@ void GDataDownloadObserver::OnUploadComplete(int32 download_id,
DCHECK(upload_data);
upload_data->MarkAsComplete();
download->MaybeCompleteDownload();
+ // MaybeCompleteDownload() only works for non-SavePackage downloads.
+ // SavePackage::Finish() is the SavePackage equivalent of
+ // MaybeCompleteDownload(). MHTML SavePackages may upload to GData (see
+ // SavePackageFilePickerChromeOS), so MHTML SavePackages use
+ // OnDownloadUpdated() to wait for the upload to complete before calling
+ // Finish(). Call UpdateObservers() manually now in case this download is an
+ // MHTML SavePackage.
+ download->UpdateObservers();
}
} // namespace gdata
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/download/chrome_download_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698