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

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

Issue 10665049: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 3f5dc5fe4c63dda0b772c5570b670582c252fae2..dd98422ce3064ab303920493959e9bb3b34ebf8d 100644
--- a/chrome/browser/download/download_test_observer.cc
+++ b/chrome/browser/download/download_test_observer.cc
@@ -85,17 +85,15 @@ bool DownloadTestObserver::IsFinished() const {
wait_count_);
}
-void DownloadTestObserver::OnDownloadUpdated(DownloadItem* download) {
- // The REMOVING state indicates that the download is being destroyed.
+void DownloadTestObserver::OnDownloadDestroyed(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())) {
@@ -268,17 +266,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::OnDownloadDestroyed(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