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

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

Issue 1418663010: Adding WebContent-free Download (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaning up headers. Created 5 years, 1 month 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/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());
« no previous file with comments | « no previous file | content/browser/download/download_manager_impl.cc » ('j') | content/browser/download/download_manager_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698