| 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.h" | 5 #include "components/ntp_tiles/popular_sites.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "components/search_engines/search_engine_type.h" | 28 #include "components/search_engines/search_engine_type.h" |
| 29 #include "components/search_engines/template_url_prepopulate_data.h" | 29 #include "components/search_engines/template_url_prepopulate_data.h" |
| 30 #include "components/search_engines/template_url_service.h" | 30 #include "components/search_engines/template_url_service.h" |
| 31 #include "components/variations/service/variations_service.h" | 31 #include "components/variations/service/variations_service.h" |
| 32 #include "net/base/load_flags.h" | 32 #include "net/base/load_flags.h" |
| 33 #include "net/http/http_status_code.h" | 33 #include "net/http/http_status_code.h" |
| 34 | 34 |
| 35 using net::URLFetcher; | 35 using net::URLFetcher; |
| 36 using variations::VariationsService; | 36 using variations::VariationsService; |
| 37 | 37 |
| 38 namespace ntp_tiles { |
| 39 |
| 38 namespace { | 40 namespace { |
| 39 | 41 |
| 40 const char kPopularSitesURLFormat[] = | 42 const char kPopularSitesURLFormat[] = |
| 41 "https://www.gstatic.com/chrome/ntp/suggested_sites_%s_%s.json"; | 43 "https://www.gstatic.com/chrome/ntp/suggested_sites_%s_%s.json"; |
| 42 const char kPopularSitesDefaultCountryCode[] = "DEFAULT"; | 44 const char kPopularSitesDefaultCountryCode[] = "DEFAULT"; |
| 43 const char kPopularSitesDefaultVersion[] = "5"; | 45 const char kPopularSitesDefaultVersion[] = "5"; |
| 44 const char kPopularSitesLocalFilename[] = "suggested_sites.json"; | 46 const char kPopularSitesLocalFilename[] = "suggested_sites.json"; |
| 45 const int kPopularSitesRedownloadIntervalHours = 24; | 47 const int kPopularSitesRedownloadIntervalHours = 24; |
| 46 | 48 |
| 47 const char kPopularSitesLastDownloadPref[] = "popular_sites_last_download"; | 49 const char kPopularSitesLastDownloadPref[] = "popular_sites_last_download"; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 DLOG(WARNING) << "Download country site list failed"; | 395 DLOG(WARNING) << "Download country site list failed"; |
| 394 is_fallback_ = true; | 396 is_fallback_ = true; |
| 395 pending_country_ = kPopularSitesDefaultCountryCode; | 397 pending_country_ = kPopularSitesDefaultCountryCode; |
| 396 pending_version_ = kPopularSitesDefaultVersion; | 398 pending_version_ = kPopularSitesDefaultVersion; |
| 397 FetchPopularSites(GetPopularSitesURL()); | 399 FetchPopularSites(GetPopularSitesURL()); |
| 398 } else { | 400 } else { |
| 399 DLOG(WARNING) << "Download fallback site list failed"; | 401 DLOG(WARNING) << "Download fallback site list failed"; |
| 400 callback_.Run(false); | 402 callback_.Run(false); |
| 401 } | 403 } |
| 402 } | 404 } |
| 405 |
| 406 } // namespace ntp_tiles |
| OLD | NEW |