| 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..d951bd96ff4e680486f8f414bfed6279569fd8ab 100644
|
| --- a/components/ntp_tiles/popular_sites_impl.cc
|
| +++ b/components/ntp_tiles/popular_sites_impl.cc
|
| @@ -129,10 +129,23 @@ PopularSites::SitesVector ParseSiteList(const base::ListValue& list) {
|
|
|
| sites.emplace_back(title, GURL(url), GURL(favicon_url),
|
| GURL(large_icon_url), GURL(thumbnail_url));
|
| + item->GetInteger("default_resource_id", &sites.back().default_resource_id);
|
| }
|
| return sites;
|
| }
|
|
|
| +#if defined(OS_ANDROID) || defined(OS_IOS)
|
| +void SetDefaultResourceForSite(base::ListValue* sites,
|
| + int index,
|
| + int resource_id) {
|
| + base::DictionaryValue* site;
|
| + if (!sites->GetDictionary(index, &site)) {
|
| + return;
|
| + }
|
| + site->SetInteger("default_resource_id", resource_id);
|
| +}
|
| +#endif
|
| +
|
| // Creates the list of popular sites based on a snapshot available for mobile.
|
| std::unique_ptr<base::ListValue> DefaultPopularSites() {
|
| #if defined(OS_ANDROID) || defined(OS_IOS)
|
| @@ -141,6 +154,15 @@ std::unique_ptr<base::ListValue> DefaultPopularSites() {
|
| ResourceBundle::GetSharedInstance().GetRawDataResource(
|
| IDR_DEFAULT_POPULAR_SITES_JSON)));
|
| DCHECK(sites);
|
| + int index = 0;
|
| + for (int resource :
|
| + {IDR_DEFAULT_POPULAR_SITES_ICON0, IDR_DEFAULT_POPULAR_SITES_ICON1,
|
| + IDR_DEFAULT_POPULAR_SITES_ICON2, IDR_DEFAULT_POPULAR_SITES_ICON3,
|
| + IDR_DEFAULT_POPULAR_SITES_ICON4, IDR_DEFAULT_POPULAR_SITES_ICON5,
|
| + IDR_DEFAULT_POPULAR_SITES_ICON6, IDR_DEFAULT_POPULAR_SITES_ICON7}) {
|
| + SetDefaultResourceForSite(sites.get(), index++, resource);
|
| + }
|
| +
|
| return sites;
|
| #endif
|
| return base::MakeUnique<base::ListValue>();
|
| @@ -157,7 +179,8 @@ PopularSites::Site::Site(const base::string16& title,
|
| url(url),
|
| favicon_url(favicon_url),
|
| large_icon_url(large_icon_url),
|
| - thumbnail_url(thumbnail_url) {}
|
| + thumbnail_url(thumbnail_url),
|
| + default_resource_id(-1) {}
|
|
|
| PopularSites::Site::Site(const Site& other) = default;
|
|
|
|
|