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

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

Issue 16994004: Remove DownloadItem::Is*() in favor of DI::GetState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@di-getstate-2
Patch Set: Rebased to fix new test, applied suggestions from bauerb and benjhayden Created 7 years, 6 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
Index: content/browser/download/download_manager_impl.cc
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index d57c239677c8a3b10128faa58207ec49c9a14ad2..f7a8b2ee2d77d6948e44d1c02830147aa10cee93 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -372,7 +372,7 @@ DownloadItem* DownloadManagerImpl::StartDownload(
DownloadMap::iterator item_iterator = downloads_.find(id.local());
// Trying to resume an interrupted download.
if (item_iterator == downloads_.end() ||
- item_iterator->second->IsCancelled()) {
+ (item_iterator->second->GetState() == DownloadItem::CANCELLED)) {
// If the download is no longer known to the DownloadManager, then it was
// removed after it was resumed. Ignore. If the download is cancelled
// while resuming, then also ignore the request.
@@ -380,7 +380,7 @@ DownloadItem* DownloadManagerImpl::StartDownload(
return NULL;
}
download = item_iterator->second;
- DCHECK(download->IsInterrupted());
+ DCHECK_EQ(DownloadItem::INTERRUPTED, download->GetState());
}
base::FilePath default_download_directory;
@@ -425,7 +425,7 @@ void DownloadManagerImpl::CheckForHistoryFilesRemoval() {
void DownloadManagerImpl::CheckForFileRemoval(DownloadItemImpl* download_item) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (download_item->IsComplete() &&
+ if ((download_item->GetState() == DownloadItem::COMPLETE) &&
!download_item->GetFileExternallyRemoved() &&
delegate_) {
delegate_->CheckForFileExistence(
@@ -530,7 +530,7 @@ int DownloadManagerImpl::RemoveDownloadsBetween(base::Time remove_begin,
if (download->GetStartTime() >= remove_begin &&
(remove_end.is_null() || download->GetStartTime() < remove_end) &&
- !download->IsInProgress()) {
+ (download->GetState() != DownloadItem::IN_PROGRESS)) {
// Erases the download from downloads_.
download->Remove();
count++;
@@ -609,7 +609,7 @@ int DownloadManagerImpl::InProgressCount() const {
int count = 0;
for (DownloadMap::const_iterator it = downloads_.begin();
it != downloads_.end(); ++it) {
- if (it->second->IsInProgress())
+ if (it->second->GetState() == DownloadItem::IN_PROGRESS)
++count;
}
return count;
@@ -631,7 +631,7 @@ void DownloadManagerImpl::OpenDownload(DownloadItemImpl* download) {
for (DownloadMap::iterator it = downloads_.begin();
it != downloads_.end(); ++it) {
DownloadItemImpl* item = it->second;
- if (item->IsComplete() &&
+ if ((item->GetState() == DownloadItem::COMPLETE) &&
!item->GetOpened())
++num_unopened;
}
« no previous file with comments | « content/browser/download/download_item_impl_unittest.cc ('k') | content/browser/download/download_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698