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

Unified Diff: chrome/browser/android/most_visited_sites.cc

Issue 1787633002: Use whitelist large icon for corresponding most visited suggestions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@icon-whitelist
Patch Set: Rebased against previous CL Created 4 years, 9 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
Index: chrome/browser/android/most_visited_sites.cc
diff --git a/chrome/browser/android/most_visited_sites.cc b/chrome/browser/android/most_visited_sites.cc
index 5aeceb28b788e31fd580548aaba28adf78bcf74c..31708f3d3a6a305bfcc77ae762c7899aa5f26d6b 100644
--- a/chrome/browser/android/most_visited_sites.cc
+++ b/chrome/browser/android/most_visited_sites.cc
@@ -458,11 +458,23 @@ void MostVisitedSites::InitiateTopSitesQuery() {
false);
}
+base::FilePath MostVisitedSites::GetWhitelistLargeIconPath(const GURL& url) {
+ SupervisedUserService* supervised_user_service =
+ SupervisedUserServiceFactory::GetForProfile(profile_);
+
+ for (const auto& whitelist : supervised_user_service->whitelists()) {
+ if (whitelist->entry_point().GetContent() == url.GetContent())
Bernhard Bauer 2016/03/17 15:49:00 Hm... content is everything after the scheme, so i
atanasova 2016/03/17 16:02:08 Marc and I discussed in the previous comments that
Marc Treib 2016/03/17 16:29:02 I think Bernhard's suggesting to use less than the
Bernhard Bauer 2016/03/17 17:44:30 Exactly. And in particular, I'd like to explicitly
atanasova 2016/03/22 12:21:49 Changed to use host+path as discussed here and in
+ return whitelist->large_icon_path();
+ }
+ return base::FilePath();
+}
+
void MostVisitedSites::OnMostVisitedURLsAvailable(
const history::MostVisitedURLList& visited_list) {
SupervisedUserURLFilter* url_filter =
SupervisedUserServiceFactory::GetForProfile(profile_)
->GetURLFilterForUIThread();
+
MostVisitedSites::SuggestionsVector suggestions;
size_t num_tiles =
std::min(visited_list.size(), static_cast<size_t>(num_sites_));
@@ -481,6 +493,7 @@ void MostVisitedSites::OnMostVisitedURLsAvailable(
suggestion->title = visited.title;
suggestion->url = visited.url;
suggestion->source = TOP_SITES;
+ suggestion->whitelist_icon_path = GetWhitelistLargeIconPath(visited.url);
suggestions.push_back(std::move(suggestion));
}
@@ -518,6 +531,8 @@ void MostVisitedSites::OnSuggestionsProfileAvailable(
generated_suggestion->title = base::UTF8ToUTF16(suggestion.title());
generated_suggestion->url = GURL(suggestion.url());
generated_suggestion->source = SUGGESTIONS_SERVICE;
+ generated_suggestion->whitelist_icon_path = GetWhitelistLargeIconPath(
+ GURL(suggestion.url()));
if (suggestion.providers_size() > 0)
generated_suggestion->provider_index = suggestion.providers(0);
« chrome/browser/android/most_visited_sites.h ('K') | « chrome/browser/android/most_visited_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698