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

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

Issue 783963003: Removing HistoryService::profile() method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/last_download_finder.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b3e4f3ff7634f9080b1a1eb6a4ea3c21b6cdd62b..cda5a88c4fc66390398e6ec53be4583715721ecf 100644
--- a/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/last_download_finder.cc
@@ -246,23 +246,6 @@ void LastDownloadFinder::OnMetadataQuery(
}
}
-void LastDownloadFinder::OnProfileHistoryLoaded(
- Profile* profile,
- HistoryService* history_service) {
- auto iter = profile_states_.find(profile);
- if (iter == profile_states_.end())
- return;
-
- // Start the query in the history service if the finder was waiting for the
- // service to load.
- if (iter->second == WAITING_FOR_HISTORY) {
- history_service->QueryDownloads(
- base::Bind(&LastDownloadFinder::OnDownloadQuery,
- weak_ptr_factory_.GetWeakPtr(),
- profile));
- }
-}
-
void LastDownloadFinder::AbandonSearchInProfile(Profile* profile) {
// |profile| may not be present in the set of profiles.
auto iter = profile_states_.find(profile);
@@ -339,7 +322,21 @@ void LastDownloadFinder::Observe(int type,
void LastDownloadFinder::OnHistoryServiceLoaded(
HistoryService* history_service) {
- OnProfileHistoryLoaded(history_service->profile(), history_service);
+ for (const auto& pair : profile_states_) {
+ HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists(
sky 2014/12/11 19:23:49 IMO the old way is cleaner. Why do you need to rem
+ pair.first, Profile::EXPLICIT_ACCESS);
+ if (hs == history_service) {
+ // Start the query in the history service if the finder was waiting for
+ // the service to load.
+ if (pair.second == WAITING_FOR_HISTORY) {
+ history_service->QueryDownloads(
+ base::Bind(&LastDownloadFinder::OnDownloadQuery,
+ weak_ptr_factory_.GetWeakPtr(),
+ pair.first));
+ }
+ return;
+ }
+ }
}
void LastDownloadFinder::HistoryServiceBeingDeleted(
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/last_download_finder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698