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

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

Issue 11673003: UI changes associated with downloads resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged from DownloadsResumption; includes CanResumeDownload, which was nuked in the original CL. Created 7 years, 12 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 | « content/browser/download/download_item_impl.h ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698