Chromium Code Reviews| Index: content/browser/download/download_item_impl.cc |
| diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc |
| index 42c0f778d27b1e9870778bf74eca8dff68291af1..a5afb969b4e63aabfe5553f20f78e3fbd30818ce 100644 |
| --- a/content/browser/download/download_item_impl.cc |
| +++ b/content/browser/download/download_item_impl.cc |
| @@ -504,11 +504,6 @@ bool DownloadItemImpl::CanResume() const { |
| if (state_ != INTERRUPTED_INTERNAL) |
| return false; |
| - // Downloads that don't have a WebContents should still be resumable, but this |
| - // isn't currently the case. See ResumeInterruptedDownload(). |
| - if (!GetWebContents()) |
| - return false; |
| - |
|
asanka
2015/11/20 19:57:46
In addition, let's check that the download URL Sch
svaldez
2015/11/23 15:18:56
Done.
|
| ResumeMode resume_mode = GetResumeMode(); |
| return IsDownloadResumptionEnabled() && |
| (resume_mode == RESUME_MODE_USER_RESTART || |
| @@ -1693,13 +1688,6 @@ void DownloadItemImpl::ResumeInterruptedDownload() { |
| if (state_ != INTERRUPTED_INTERNAL) |
| return; |
| - // If we can't get a web contents, we can't resume the download. |
| - // TODO(rdsmith): Find some alternative web contents to use--this |
| - // means we can't restart a download if it's a download imported |
| - // from the history. |
| - if (!GetWebContents()) |
| - return; |
| - |
| // Reset the appropriate state if restarting. |
| ResumeMode mode = GetResumeMode(); |
| if (mode == RESUME_MODE_IMMEDIATE_RESTART || |
| @@ -1710,9 +1698,15 @@ void DownloadItemImpl::ResumeInterruptedDownload() { |
| etag_ = ""; |
| } |
| - scoped_ptr<DownloadUrlParameters> download_params( |
| - DownloadUrlParameters::FromWebContents(GetWebContents(), |
| - GetOriginalUrl())); |
| + scoped_ptr<DownloadUrlParameters> download_params; |
| + if (GetWebContents()) { |
| + download_params = DownloadUrlParameters::FromWebContents(GetWebContents(), |
| + GetOriginalUrl()); |
| + } else { |
| + download_params = make_scoped_ptr( |
| + new DownloadUrlParameters(GetOriginalUrl(), -1, -1, -1, |
| + GetBrowserContext()->GetResourceContext())); |
|
asanka
2015/11/20 19:57:46
Do we need to worry about storage partitions here?
svaldez
2015/11/23 15:18:56
Not sure. I think this defaults in the correct way
|
| + } |
| download_params->set_file_path(GetFullPath()); |
| download_params->set_offset(GetReceivedBytes()); |