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 |