Commit c358578a authored by paritosh.in's avatar paritosh.in Committed by Commit bot

Removing HistoryService::profile() method

As per review comments on the issue
https://codereview.chromium.org/573553004/#msg3
removing HistoryService::profile() method.

BUG=430070

Review URL: https://codereview.chromium.org/783963003

Cr-Commit-Position: refs/heads/master@{#308132}
parent da6705ff
......@@ -53,10 +53,6 @@ class FilePath;
class Thread;
}
namespace safe_browsing {
class LastDownloadFinder;
}
namespace visitedlink {
class VisitedLinkMaster;
}
......@@ -543,7 +539,6 @@ class HistoryService : public content::NotificationObserver,
friend class HistoryURLProviderTest;
friend class history::InMemoryURLIndexTest;
template<typename Info, typename Callback> friend class DownloadRequest;
friend class safe_browsing::LastDownloadFinder;
friend class PageUsageRequest;
friend class RedirectRequest;
friend class SyncBookmarkDataTypeControllerTest;
......@@ -858,9 +853,6 @@ class HistoryService : public content::NotificationObserver,
a, b, c, d, e));
}
// TODO(sdefresne): http://crbug.com/430070 remove this method.
Profile* profile() { return profile_; }
base::ThreadChecker thread_checker_;
content::NotificationRegistrar registrar_;
......
......@@ -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(
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(
......
......@@ -90,11 +90,6 @@ class LastDownloadFinder : public content::NotificationObserver,
Profile* profile,
scoped_ptr<ClientIncidentReport_DownloadDetails> details);
// Initiates a search in |profile| if it is in the set of profiles to be
// searched.
void OnProfileHistoryLoaded(Profile* profile,
HistoryService* history_service);
// Abandons the search for downloads in |profile|, reporting results if there
// are no more pending queries.
void AbandonSearchInProfile(Profile* profile);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment