Chromium Code Reviews| Index: content/browser/download/download_manager_impl.cc |
| diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc |
| index 3fcb33ef51edfe4b895112a7ce292e14f8af65c4..a7d66d2cb9593cfa1b1212de2802a8ee2511c46d 100644 |
| --- a/content/browser/download/download_manager_impl.cc |
| +++ b/content/browser/download/download_manager_impl.cc |
| @@ -119,31 +119,17 @@ class DownloadItemFactoryImpl : public DownloadItemFactory { |
| const std::string& last_modified, |
| int64_t received_bytes, |
| int64_t total_bytes, |
| + const std::string& hash, |
| DownloadItem::DownloadState state, |
| DownloadDangerType danger_type, |
| DownloadInterruptReason interrupt_reason, |
| bool opened, |
| const net::BoundNetLog& bound_net_log) override { |
| return new DownloadItemImpl( |
| - delegate, |
| - download_id, |
| - current_path, |
| - target_path, |
| - url_chain, |
| - referrer_url, |
| - mime_type, |
| - original_mime_type, |
| - start_time, |
| - end_time, |
| - etag, |
| - last_modified, |
| - received_bytes, |
| - total_bytes, |
| - state, |
| - danger_type, |
| - interrupt_reason, |
| - opened, |
| - bound_net_log); |
| + delegate, download_id, current_path, target_path, url_chain, |
|
svaldez
2016/03/09 19:27:34
Possibly revert to make it easier to read.
asanka
2016/03/10 16:48:08
Hmm. Perhaps we should revisit the BinPackArgument
|
| + referrer_url, mime_type, original_mime_type, start_time, end_time, etag, |
| + last_modified, received_bytes, total_bytes, hash, state, danger_type, |
| + interrupt_reason, opened, bound_net_log); |
| } |
| DownloadItemImpl* CreateActiveItem( |
| @@ -362,16 +348,13 @@ void DownloadManagerImpl::StartDownloadWithId( |
| if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) { |
| DCHECK(stream.get()); |
| download_file.reset(file_factory_->CreateFile( |
| - *info->save_info, default_download_directory, info->url(), |
| - info->referrer_url, delegate_ && delegate_->GenerateFileHash(), |
| - std::move(info->save_info->file), std::move(stream), |
| - download->GetBoundNetLog(), download->DestinationObserverAsWeakPtr())); |
| - |
| - if (download_file.get() && delegate_) { |
| - download_file->SetClientGuid( |
| - delegate_->ApplicationClientIdForFileScanning()); |
| - } |
| + std::move(info->save_info), default_download_directory, |
| + std::move(stream), download->GetBoundNetLog(), |
| + download->DestinationObserverAsWeakPtr())); |
| } |
| + // It is important to leave info->save_info intact in the case of an interrupt |
| + // so that the DownloadItem can salvage what it can out of a failed resumption |
| + // attempt. |
| download->Start(std::move(download_file), std::move(info->request_handle), |
| *info); |
| @@ -609,6 +592,7 @@ DownloadItem* DownloadManagerImpl::CreateDownloadItem( |
| const std::string& last_modified, |
| int64_t received_bytes, |
| int64_t total_bytes, |
| + const std::string& hash, |
| DownloadItem::DownloadState state, |
| DownloadDangerType danger_type, |
| DownloadInterruptReason interrupt_reason, |
| @@ -618,25 +602,10 @@ DownloadItem* DownloadManagerImpl::CreateDownloadItem( |
| return NULL; |
| } |
| DownloadItemImpl* item = item_factory_->CreatePersistedItem( |
| - this, |
| - id, |
| - current_path, |
| - target_path, |
| - url_chain, |
| - referrer_url, |
| - mime_type, |
| - original_mime_type, |
| - start_time, |
| - end_time, |
| - etag, |
| - last_modified, |
| - received_bytes, |
| - total_bytes, |
| - state, |
| - danger_type, |
| - interrupt_reason, |
| - opened, |
| - net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD)); |
| + this, id, current_path, target_path, url_chain, referrer_url, mime_type, |
| + original_mime_type, start_time, end_time, etag, last_modified, |
| + received_bytes, total_bytes, hash, state, danger_type, interrupt_reason, |
| + opened, net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD)); |
| downloads_[id] = item; |
| FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated(this, item)); |
| DVLOG(20) << __FUNCTION__ << "() download = " << item->DebugString(true); |