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 9d8e9f08d59b08ac87f92529e8f4aef497e76cb7..342e452952a5654459610cd81f1eba42fe8c2b50 100644 |
--- a/content/browser/download/download_item_impl.cc |
+++ b/content/browser/download/download_item_impl.cc |
@@ -280,12 +280,12 @@ void DownloadItemImpl::UpdateObservers() { |
void DownloadItemImpl::ValidateDangerousDownload() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- DCHECK_EQ(IN_PROGRESS, GetState()); |
+ DCHECK(IsPartialDownload()); |
DCHECK(IsDangerous()); |
VLOG(20) << __FUNCTION__ << " download=" << DebugString(true); |
- if (GetState() != IN_PROGRESS) |
+ if (!IsPartialDownload() || !IsDangerous()) |
return; |
RecordDangerousDownloadAccept(GetDangerType()); |
@@ -423,7 +423,7 @@ void DownloadItemImpl::Remove() { |
void DownloadItemImpl::OpenDownload() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- if (state_ == IN_PROGRESS_INTERNAL) { |
+ if (IsPartialDownload()) { |
// We don't honor the open_when_complete_ flag for temporary |
// downloads. Don't set it because it shows up in the UI. |
if (!IsTemporary()) |
@@ -493,13 +493,9 @@ bool DownloadItemImpl::CanResume() const { |
resume_mode == RESUME_MODE_USER_CONTINUE); |
} |
-// TODO(rdsmith): Figure out whether or not we want this probe routine |
-// to consider interrupted (resumably) downloads partial downloads. |
-// Conceptually the answer is probably yes, but everywhere that currently |
-// uses the routine is using it as a synonym for IsInProgress(). |
bool DownloadItemImpl::IsPartialDownload() const { |
- DownloadState state = InternalToExternalState(state_); |
- return (state == IN_PROGRESS); |
+ return InternalToExternalState(state_) == IN_PROGRESS || CanResume() || |
+ state_ == RESUMING_INTERNAL; |
} |
bool DownloadItemImpl::IsInProgress() const { |
@@ -689,7 +685,7 @@ bool DownloadItemImpl::CanOpenDownload() { |
// We can open the file or mark it for opening on completion if the download |
// is expected to complete successfully. Exclude temporary downloads, since |
// they aren't owned by the download system. |
- return (IsInProgress() || IsComplete()) && !IsTemporary() && |
+ return (IsPartialDownload() || IsComplete()) && !IsTemporary() && |
!file_externally_removed_; |
} |