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

Unified Diff: chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc

Issue 351053003: Port HistoryService::QueryFilteredURLs to CancelableRequestTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc
diff --git a/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc b/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc
index 717add4f1f2563ea7d93acdae333abcef69d8ca4..3cfe6e339751298781f43a4aa029d331eb6f5f48 100644
--- a/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc
+++ b/chrome/browser/ui/webui/ntp/suggestions_source_top_sites.cc
@@ -61,7 +61,7 @@ void SuggestionsSourceTopSites::FetchItems(Profile* profile) {
DCHECK(combiner_);
STLDeleteElements(&items_);
- history_consumer_.CancelAllRequests();
+ history_tracker_.TryCancelAll();
HistoryService* history = HistoryServiceFactory::GetForProfile(
profile, Profile::EXPLICIT_ACCESS);
// |history| may be null during unit tests.
@@ -71,9 +71,13 @@ void SuggestionsSourceTopSites::FetchItems(Profile* profile) {
time_filter.SetFilterWidth(GetFilterWidth());
time_filter.set_sorting_order(GetSortingOrder());
- history->QueryFilteredURLs(0, time_filter, debug_, &history_consumer_,
+ history->QueryFilteredURLs(
+ 0,
+ time_filter,
+ debug_,
base::Bind(&SuggestionsSourceTopSites::OnSuggestionsUrlsAvailable,
- base::Unretained(this)));
+ base::Unretained(this)),
+ &history_tracker_);
}
}
@@ -83,11 +87,13 @@ void SuggestionsSourceTopSites::SetCombiner(SuggestionsCombiner* combiner) {
}
void SuggestionsSourceTopSites::OnSuggestionsUrlsAvailable(
- CancelableRequestProvider::Handle handle,
- const history::FilteredURLList& data) {
+ const history::FilteredURLList* data) {
+ DCHECK(data);
DCHECK(combiner_);
- for (size_t i = 0; i < data.size(); i++) {
- const history::FilteredURL& suggested_url = data[i];
+ for (history::FilteredURLList::const_iterator iter = data->begin();
+ iter != data->end();
+ ++iter) {
+ const history::FilteredURL& suggested_url = *iter;
Dan Beam 2014/06/26 03:47:33 nit: revert this hunk, data[i] -> (*data)[i]
sdefresne 2014/06/28 07:59:47 Done.
if (suggested_url.url.is_empty())
continue;
« no previous file with comments | « chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698