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

Unified Diff: content/browser/download/drag_download_file.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/drag_download_file.cc
diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc
index c96ad9746779661f300282de1080f8bae9d0e680..68dd34e4b24393a0f785ebc7a3c6fc67c6ee5ce0 100644
--- a/content/browser/download/drag_download_file.cc
+++ b/content/browser/download/drag_download_file.cc
@@ -105,12 +105,13 @@ class DragDownloadFile::DragDownloadFileUI : public DownloadItem::Observer {
virtual void OnDownloadUpdated(DownloadItem* item) OVERRIDE {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(download_item_, item);
- if (download_item_->IsComplete() ||
- download_item_->IsCancelled() ||
- download_item_->IsInterrupted()) {
+ DownloadItem::DownloadState state = download_item_->GetState();
+ if (state == DownloadItem::COMPLETE ||
+ state == DownloadItem::CANCELLED ||
+ state == DownloadItem::INTERRUPTED) {
if (!on_completed_.is_null()) {
on_completed_loop_->PostTask(FROM_HERE, base::Bind(
- on_completed_, download_item_->IsComplete()));
+ on_completed_, state == DownloadItem::COMPLETE));
on_completed_.Reset();
}
download_item_->RemoveObserver(this);
@@ -123,8 +124,10 @@ class DragDownloadFile::DragDownloadFileUI : public DownloadItem::Observer {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_EQ(download_item_, item);
if (!on_completed_.is_null()) {
+ const bool is_complete =
+ download_item_->GetState() == DownloadItem::COMPLETE;
on_completed_loop_->PostTask(FROM_HERE, base::Bind(
- on_completed_, download_item_->IsComplete()));
+ on_completed_, is_complete));
on_completed_.Reset();
}
download_item_->RemoveObserver(this);
« no previous file with comments | « content/browser/download/download_manager_impl_unittest.cc ('k') | content/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698