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

Unified Diff: chrome/browser/download/download_test_observer.cc

Issue 10704026: Reland DownloadItem::Observer::OnDownloadDestroyed() replaces DownloadItem::REMOVING (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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: chrome/browser/download/download_test_observer.cc
diff --git a/chrome/browser/download/download_test_observer.cc b/chrome/browser/download/download_test_observer.cc
index 13d6791f4794d8f59cd483d89b2718df9e94b948..3ed32237b8fe2410c3b47bba19a4ed8705669090 100644
--- a/chrome/browser/download/download_test_observer.cc
+++ b/chrome/browser/download/download_test_observer.cc
@@ -83,17 +83,15 @@ bool DownloadTestObserver::IsFinished() const {
return (finish_on_select_file_ && select_file_dialog_seen_);
}
-void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
- // The REMOVING state indicates that the download is being destroyed.
+void DownloadTestObserver::OnDownloadDestructed(DownloadItem* download) {
// Stop observing. Do not do anything with it, as it is about to be gone.
- if (download->GetState() == DownloadItem::REMOVING) {
- DownloadSet::iterator it = downloads_observed_.find(download);
- ASSERT_TRUE(it != downloads_observed_.end());
- downloads_observed_.erase(it);
- download->RemoveObserver(this);
- return;
- }
+ DownloadSet::iterator it = downloads_observed_.find(download);
+ ASSERT_TRUE(it != downloads_observed_.end());
+ downloads_observed_.erase(it);
+ download->RemoveObserver(this);
+}
+void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
// Real UI code gets the user's response after returning from the observer.
if (download->GetSafetyState() == DownloadItem::DANGEROUS &&
!ContainsKey(dangerous_downloads_seen_, download->GetId())) {
@@ -277,17 +275,15 @@ void DownloadTestFlushObserver::ModelChanged(DownloadManager* manager) {
CheckDownloadsInProgress(true);
}
-void DownloadTestFlushObserver::OnDownloadUpdated(DownloadItem* download) {
- // The REMOVING state indicates that the download is being destroyed.
+void DownloadTestFlushObserver::OnDownloadDestructed(DownloadItem* download) {
// Stop observing. Do not do anything with it, as it is about to be gone.
- if (download->GetState() == DownloadItem::REMOVING) {
- DownloadSet::iterator it = downloads_observed_.find(download);
- ASSERT_TRUE(it != downloads_observed_.end());
- downloads_observed_.erase(it);
- download->RemoveObserver(this);
- return;
- }
+ DownloadSet::iterator it = downloads_observed_.find(download);
+ ASSERT_TRUE(it != downloads_observed_.end());
+ downloads_observed_.erase(it);
+ download->RemoveObserver(this);
+}
+void DownloadTestFlushObserver::OnDownloadUpdated(DownloadItem* download) {
// No change in DownloadItem set on manager.
CheckDownloadsInProgress(false);
}

Powered by Google App Engine
This is Rietveld 408576698