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 df138ced42329afa18844736a20a48b9f07602bb..4ba68aca43604c00efb6d3425a3b3736ec925488 100644 |
--- a/content/browser/download/download_item_impl.cc |
+++ b/content/browser/download/download_item_impl.cc |
@@ -478,6 +478,10 @@ bool DownloadItemImpl::IsPaused() const { |
return is_paused_; |
} |
+bool DownloadItemImpl::CanResumeInterrupted() const { |
+ return GetResumeMode() != RESUME_MODE_INVALID; |
+} |
+ |
bool DownloadItemImpl::IsTemporary() const { |
return is_temporary_; |
} |
@@ -686,6 +690,22 @@ bool DownloadItemImpl::CanOpenDownload() { |
!file_externally_removed_; |
} |
+bool DownloadItemImpl::CanResumeDownload() const { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ // Do not allow interrupted downloads to be resumed until the target name |
+ // has been determined, and the user has validated any dangerous items. |
+ // TODO(rdsmith) -- Add a state indicating that filename determination has |
+ // occurred. |
+ if (GetTargetFilePath().empty()) |
+ return false; |
+ |
+ if (GetSafetyState() == DANGEROUS) |
+ return false; |
+ |
+ return IsInProgress() || (GetResumeMode() != RESUME_MODE_INVALID); |
+} |
+ |
bool DownloadItemImpl::ShouldOpenFileBasedOnExtension() { |
return delegate_->ShouldOpenFileBasedOnExtension(GetUserVerifiedFilePath()); |
} |