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

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

Issue 10704026: Reland DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: lint Created 8 years, 4 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_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index b7b7ee412e32e58bb67ddf2f5eb25bc0ea37a23d..95af4a2cbac8966f44dc2eef00d67249142413b3 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -87,8 +87,6 @@ const char* DebugDownloadStateString(DownloadItem::DownloadState state) {
return "COMPLETE";
case DownloadItem::CANCELLED:
return "CANCELLED";
- case DownloadItem::REMOVING:
- return "REMOVING";
case DownloadItem::INTERRUPTED:
return "INTERRUPTED";
default:
@@ -299,8 +297,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
DownloadItemImpl::~DownloadItemImpl() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- TransitionTo(REMOVING);
+ FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this));
delegate_->AssertStateConsistent(this);
delegate_->Detach();
}
@@ -652,11 +649,15 @@ void DownloadItemImpl::Remove() {
Cancel(true);
delegate_->AssertStateConsistent(this);
- TransitionTo(REMOVING);
+ NotifyRemoved();
delegate_->DownloadRemoved(this);
// We have now been deleted.
}
+void DownloadItemImpl::NotifyRemoved() {
+ FOR_EACH_OBSERVER(Observer, observers_, OnDownloadRemoved(this));
+}
+
bool DownloadItemImpl::TimeRemaining(base::TimeDelta* remaining) const {
if (total_bytes_ <= 0)
return false; // We never received the content_length for this download.

Powered by Google App Engine
This is Rietveld 408576698