| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_tiles/popular_sites_impl.h" | 5 #include "components/ntp_tiles/popular_sites_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 base::DictionaryValue* site; | 146 base::DictionaryValue* site; |
| 147 if (!sites->GetDictionary(index, &site)) { | 147 if (!sites->GetDictionary(index, &site)) { |
| 148 return; | 148 return; |
| 149 } | 149 } |
| 150 site->SetInteger("default_icon_resource", resource_id); | 150 site->SetInteger("default_icon_resource", resource_id); |
| 151 } | 151 } |
| 152 #endif | 152 #endif |
| 153 | 153 |
| 154 // Creates the list of popular sites based on a snapshot available for mobile. | 154 // Creates the list of popular sites based on a snapshot available for mobile. |
| 155 std::unique_ptr<base::ListValue> DefaultPopularSites() { | 155 std::unique_ptr<base::ListValue> DefaultPopularSites() { |
| 156 #if !defined(OS_ANDROID) | 156 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 157 return base::MakeUnique<base::ListValue>(); | 157 return base::MakeUnique<base::ListValue>(); |
| 158 #else | 158 #else |
| 159 if (!base::FeatureList::IsEnabled(kPopularSitesBakedInContentFeature)) { | 159 if (!base::FeatureList::IsEnabled(kPopularSitesBakedInContentFeature)) { |
| 160 return base::MakeUnique<base::ListValue>(); | 160 return base::MakeUnique<base::ListValue>(); |
| 161 } | 161 } |
| 162 std::unique_ptr<base::ListValue> sites = | 162 std::unique_ptr<base::ListValue> sites = |
| 163 base::ListValue::From(base::JSONReader::Read( | 163 base::ListValue::From(base::JSONReader::Read( |
| 164 ResourceBundle::GetSharedInstance().GetRawDataResource( | 164 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 165 IDR_DEFAULT_POPULAR_SITES_JSON))); | 165 IDR_DEFAULT_POPULAR_SITES_JSON))); |
| 166 DCHECK(sites); | 166 DCHECK(sites); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 kPopularSitesDefaultCountryCode, | 433 kPopularSitesDefaultCountryCode, |
| 434 kPopularSitesDefaultVersion); | 434 kPopularSitesDefaultVersion); |
| 435 FetchPopularSites(); | 435 FetchPopularSites(); |
| 436 } else { | 436 } else { |
| 437 DLOG(WARNING) << "Download fallback site list failed"; | 437 DLOG(WARNING) << "Download fallback site list failed"; |
| 438 callback_.Run(false); | 438 callback_.Run(false); |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace ntp_tiles | 442 } // namespace ntp_tiles |
| OLD | NEW |