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

Unified Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2532103002: Add support for components/ntp_tiles in InstantService (Closed)
Patch Set: rebase Created 4 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 | « components/ntp_tiles/most_visited_sites.h ('k') | components/ntp_tiles/ntp_tile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_tiles/most_visited_sites.cc
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
index fe51e1d5952a8c883e49b3c539178af0267e7c71..397b9e417e57e19ef82cba73c832ca1ae7f70b0d 100644
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -109,6 +109,10 @@ void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer,
// SuggestionsService's cache or, if that is empty, sites from TopSites.
BuildCurrentTiles();
// Also start a request for fresh suggestions.
+ Refresh();
+}
+
+void MostVisitedSites::Refresh() {
suggestions_service_->FetchSuggestionsData();
}
@@ -131,6 +135,18 @@ void MostVisitedSites::AddOrRemoveBlacklistedUrl(const GURL& url,
}
}
+void MostVisitedSites::ClearBlacklistedUrls() {
+ if (top_sites_) {
+ // Always update the blacklist in the local TopSites.
+ top_sites_->ClearBlacklistedURLs();
+ }
+
+ // Only update the server-side blacklist if it's active.
+ if (mv_source_ == NTPTileSource::SUGGESTIONS_SERVICE) {
+ suggestions_service_->ClearBlacklist();
+ }
+}
+
void MostVisitedSites::OnBlockedSitesChanged() {
BuildCurrentTiles();
}
@@ -219,6 +235,8 @@ void MostVisitedSites::OnSuggestionsProfileAvailable(
tile.url = url;
tile.source = NTPTileSource::SUGGESTIONS_SERVICE;
tile.whitelist_icon_path = GetWhitelistLargeIconPath(url);
+ tile.thumbnail_url = GURL(suggestion_pb.thumbnail());
+ tile.favicon_url = GURL(suggestion_pb.favicon_url());
tiles.push_back(std::move(tile));
}
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | components/ntp_tiles/ntp_tile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698