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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/safe_browsing/incident_reporting/last_download_finder.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
index b829960180fad95137d5d39a9559e24f17d4a9b3..b27824f18679fb5a6c8b06d3bcd5937448306fb4 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
@@ -124,9 +124,6 @@ LastDownloadFinder::LastDownloadFinder(const std::vector<Profile*>& profiles,
chrome::NOTIFICATION_PROFILE_ADDED,
content::NotificationService::AllSources());
notification_registrar_.Add(this,
- chrome::NOTIFICATION_HISTORY_LOADED,
- content::NotificationService::AllSources());
- notification_registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_DESTROYED,
content::NotificationService::AllSources());
@@ -165,7 +162,10 @@ void LastDownloadFinder::SearchInProfile(Profile* profile) {
base::Bind(&LastDownloadFinder::OnDownloadQuery,
weak_ptr_factory_.GetWeakPtr(),
profile));
- } // else wait until history is loaded.
+ } else {
+ // else wait until history is loaded.
+ history_service->AddHistoryServiceObserver(this);
+ }
}
void LastDownloadFinder::OnProfileHistoryLoaded(
@@ -242,10 +242,6 @@ void LastDownloadFinder::Observe(int type,
case chrome::NOTIFICATION_PROFILE_ADDED:
SearchInProfile(content::Source<Profile>(source).ptr());
break;
- case chrome::NOTIFICATION_HISTORY_LOADED:
- OnProfileHistoryLoaded(content::Source<Profile>(source).ptr(),
- content::Details<HistoryService>(details).ptr());
- break;
case chrome::NOTIFICATION_PROFILE_DESTROYED:
AbandonSearchInProfile(content::Source<Profile>(source).ptr());
break;
@@ -254,4 +250,9 @@ void LastDownloadFinder::Observe(int type,
}
}
+void LastDownloadFinder::HistoryServiceLoaded(HistoryService* history_service) {
+ OnProfileHistoryLoaded(history_service->profile(), history_service);
+ history_service->RemoveHistoryServiceObserver(this);
+}
+
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698