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

Unified Diff: chrome/browser/download/download_path_reservation_tracker.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: chrome/browser/download/download_path_reservation_tracker.cc
diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc
index 3b6a1588dc42ededdaa2ea491b1335da7a596e25..eab019053fa5920c5716aa998640c7d395f2df66 100644
--- a/chrome/browser/download/download_path_reservation_tracker.cc
+++ b/chrome/browser/download/download_path_reservation_tracker.cc
@@ -47,7 +47,7 @@ class DownloadItemObserver : public DownloadItem::Observer {
// DownloadItem::Observer
virtual void OnDownloadUpdated(DownloadItem* download) OVERRIDE;
- virtual void OnDownloadOpened(DownloadItem* download) OVERRIDE;
+ virtual void OnDownloadDestroyed(DownloadItem* download) OVERRIDE;
DownloadItem& download_item_;
@@ -223,10 +223,6 @@ void DownloadItemObserver::OnDownloadUpdated(DownloadItem* download) {
case DownloadItem::CANCELLED:
// We no longer need the reservation if the download is being removed.
- case DownloadItem::REMOVING:
- // Ditto, but this case shouldn't happen in practice. We should have
- // received another notification beforehand.
-
case DownloadItem::INTERRUPTED:
// The download filename will need to be re-generated when the download is
// restarted. Holding on to the reservation now would prevent the name
@@ -244,10 +240,12 @@ void DownloadItemObserver::OnDownloadUpdated(DownloadItem* download) {
}
}
-void DownloadItemObserver::OnDownloadOpened(DownloadItem* download) {
- // We shouldn't be tracking reservations for a download that has been
- // externally opened. The tracker should have detached itself when the
- // download was complete.
+void DownloadItemObserver::OnDownloadDestroyed(DownloadItem* download) {
+ // This shouldn't happen. We should catch either COMPLETE, CANCELLED, or
+ // INTERRUPTED first.
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ base::Bind(&RevokeReservation, download->GetGlobalId()));
+ delete this;
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698