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

Unified Diff: components/ntp_tiles/popular_sites_impl.cc

Issue 2695713004: Add baked-in favicons for default popular sites on NTP (Closed)
Patch Set: Have python script adhere to guidelines Created 3 years, 10 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: components/ntp_tiles/popular_sites_impl.cc
diff --git a/components/ntp_tiles/popular_sites_impl.cc b/components/ntp_tiles/popular_sites_impl.cc
index 566202b07d88c8cc228312ce4c98dbf0a5776b03..842133a850fd3bb640b971228f1c2f4f4d7ed45d 100644
--- a/components/ntp_tiles/popular_sites_impl.cc
+++ b/components/ntp_tiles/popular_sites_impl.cc
@@ -21,6 +21,7 @@
#include "components/google/core/browser/google_util.h"
#include "components/ntp_tiles/constants.h"
#include "components/ntp_tiles/field_trial.h"
+#include "components/ntp_tiles/icon_cacher.h"
#include "components/ntp_tiles/pref_names.h"
#include "components/ntp_tiles/switches.h"
#include "components/pref_registry/pref_registry_syncable.h"
@@ -305,6 +306,23 @@ void PopularSitesImpl::RegisterProfilePrefs(
DefaultPopularSites().release());
}
+// static
+void PopularSitesImpl::AddIconsForDefaultPagesToCacher(const PrefService& prefs,
+ IconCacher* cacher) {
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ PopularSites::SitesVector sites =
+ ParseSiteList(*prefs.GetList(kPopularSitesJsonPref));
+ cacher->AddDefaultImage(sites[0], IDR_DEFAULT_POPULAR_SITES_ICON0);
+ cacher->AddDefaultImage(sites[1], IDR_DEFAULT_POPULAR_SITES_ICON1);
+ cacher->AddDefaultImage(sites[2], IDR_DEFAULT_POPULAR_SITES_ICON2);
+ cacher->AddDefaultImage(sites[3], IDR_DEFAULT_POPULAR_SITES_ICON3);
+ cacher->AddDefaultImage(sites[4], IDR_DEFAULT_POPULAR_SITES_ICON4);
+ cacher->AddDefaultImage(sites[5], IDR_DEFAULT_POPULAR_SITES_ICON5);
+ cacher->AddDefaultImage(sites[6], IDR_DEFAULT_POPULAR_SITES_ICON6);
+ cacher->AddDefaultImage(sites[7], IDR_DEFAULT_POPULAR_SITES_ICON7);
+#endif
+}
+
void PopularSitesImpl::FetchPopularSites() {
fetcher_ = URLFetcher::Create(pending_url_, URLFetcher::GET, this);
data_use_measurement::DataUseUserData::AttachToFetcher(

Powered by Google App Engine
This is Rietveld 408576698