| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 item->GetString("large_icon_url", &large_icon_url); | 129 item->GetString("large_icon_url", &large_icon_url); |
| 130 | 130 |
| 131 sites.emplace_back(title, GURL(url), GURL(favicon_url), | 131 sites.emplace_back(title, GURL(url), GURL(favicon_url), |
| 132 GURL(large_icon_url), GURL(thumbnail_url)); | 132 GURL(large_icon_url), GURL(thumbnail_url)); |
| 133 item->GetInteger("default_icon_resource", | 133 item->GetInteger("default_icon_resource", |
| 134 &sites.back().default_icon_resource); | 134 &sites.back().default_icon_resource); |
| 135 } | 135 } |
| 136 return sites; | 136 return sites; |
| 137 } | 137 } |
| 138 | 138 |
| 139 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_ANDROID) || defined(OS_IOS)) | 139 #if 0 && defined(GOOGLE_CHROME_BUILD) && \ |
| 140 (defined(OS_ANDROID) || defined(OS_IOS)) |
| 140 void SetDefaultResourceForSite(int index, | 141 void SetDefaultResourceForSite(int index, |
| 141 int resource_id, | 142 int resource_id, |
| 142 base::ListValue* sites) { | 143 base::ListValue* sites) { |
| 143 base::DictionaryValue* site; | 144 base::DictionaryValue* site; |
| 144 if (!sites->GetDictionary(index, &site)) { | 145 if (!sites->GetDictionary(index, &site)) { |
| 145 return; | 146 return; |
| 146 } | 147 } |
| 147 site->SetInteger("default_icon_resource", resource_id); | 148 site->SetInteger("default_icon_resource", resource_id); |
| 148 } | 149 } |
| 149 #endif | 150 #endif |
| 150 | 151 |
| 151 // Creates the list of popular sites based on a snapshot available for mobile. | 152 // Creates the list of popular sites based on a snapshot available for mobile. |
| 152 std::unique_ptr<base::ListValue> DefaultPopularSites() { | 153 std::unique_ptr<base::ListValue> DefaultPopularSites() { |
| 153 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 154 #if 1 || (!defined(OS_ANDROID) && !defined(OS_IOS)) |
| 154 return base::MakeUnique<base::ListValue>(); | 155 return base::MakeUnique<base::ListValue>(); |
| 155 #else | 156 #else |
| 156 std::unique_ptr<base::ListValue> sites = | 157 std::unique_ptr<base::ListValue> sites = |
| 157 base::ListValue::From(base::JSONReader::Read( | 158 base::ListValue::From(base::JSONReader::Read( |
| 158 ResourceBundle::GetSharedInstance().GetRawDataResource( | 159 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 159 IDR_DEFAULT_POPULAR_SITES_JSON))); | 160 IDR_DEFAULT_POPULAR_SITES_JSON))); |
| 160 DCHECK(sites); | 161 DCHECK(sites); |
| 161 #if defined(GOOGLE_CHROME_BUILD) | 162 #if defined(GOOGLE_CHROME_BUILD) |
| 162 int index = 0; | 163 int index = 0; |
| 163 for (int icon_resource : | 164 for (int icon_resource : |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, | 413 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, |
| 413 kPopularSitesDefaultVersion); | 414 kPopularSitesDefaultVersion); |
| 414 FetchPopularSites(); | 415 FetchPopularSites(); |
| 415 } else { | 416 } else { |
| 416 DLOG(WARNING) << "Download fallback site list failed"; | 417 DLOG(WARNING) << "Download fallback site list failed"; |
| 417 callback_.Run(false); | 418 callback_.Run(false); |
| 418 } | 419 } |
| 419 } | 420 } |
| 420 | 421 |
| 421 } // namespace ntp_tiles | 422 } // namespace ntp_tiles |
| OLD | NEW |