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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 user_prefs::PrefRegistrySyncable* user_prefs) { | 325 user_prefs::PrefRegistrySyncable* user_prefs) { |
326 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideURL, | 326 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideURL, |
327 std::string()); | 327 std::string()); |
328 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideCountry, | 328 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideCountry, |
329 std::string()); | 329 std::string()); |
330 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideVersion, | 330 user_prefs->RegisterStringPref(ntp_tiles::prefs::kPopularSitesOverrideVersion, |
331 std::string()); | 331 std::string()); |
332 | 332 |
333 user_prefs->RegisterInt64Pref(kPopularSitesLastDownloadPref, 0); | 333 user_prefs->RegisterInt64Pref(kPopularSitesLastDownloadPref, 0); |
334 user_prefs->RegisterStringPref(kPopularSitesURLPref, std::string()); | 334 user_prefs->RegisterStringPref(kPopularSitesURLPref, std::string()); |
335 user_prefs->RegisterListPref(kPopularSitesJsonPref, | 335 user_prefs->RegisterListPref(kPopularSitesJsonPref, DefaultPopularSites()); |
336 DefaultPopularSites().release()); | |
337 } | 336 } |
338 | 337 |
339 void PopularSitesImpl::FetchPopularSites() { | 338 void PopularSitesImpl::FetchPopularSites() { |
340 net::NetworkTrafficAnnotationTag traffic_annotation = | 339 net::NetworkTrafficAnnotationTag traffic_annotation = |
341 net::DefineNetworkTrafficAnnotation("popular_sites_fetch", R"( | 340 net::DefineNetworkTrafficAnnotation("popular_sites_fetch", R"( |
342 semantics { | 341 semantics { |
343 sender: "Popular Sites New Tab Fetch" | 342 sender: "Popular Sites New Tab Fetch" |
344 description: | 343 description: |
345 "Google Chrome may display a list of regionally-popular web sites " | 344 "Google Chrome may display a list of regionally-popular web sites " |
346 "on the New Tab Page. This service fetches the list of these sites." | 345 "on the New Tab Page. This service fetches the list of these sites." |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, | 416 pending_url_ = GetPopularSitesURL(kPopularSitesDefaultCountryCode, |
418 kPopularSitesDefaultVersion); | 417 kPopularSitesDefaultVersion); |
419 FetchPopularSites(); | 418 FetchPopularSites(); |
420 } else { | 419 } else { |
421 DLOG(WARNING) << "Download fallback site list failed"; | 420 DLOG(WARNING) << "Download fallback site list failed"; |
422 callback_.Run(false); | 421 callback_.Run(false); |
423 } | 422 } |
424 } | 423 } |
425 | 424 |
426 } // namespace ntp_tiles | 425 } // namespace ntp_tiles |
OLD | NEW |