OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/most_visited_sites.h" | 5 #include "components/ntp_tiles/most_visited_sites.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
411 return; | 411 return; |
412 | 412 |
413 observer_->OnMostVisitedURLsAvailable(current_tiles_); | 413 observer_->OnMostVisitedURLsAvailable(current_tiles_); |
414 } | 414 } |
415 | 415 |
416 void MostVisitedSites::OnPopularSitesDownloaded(bool success) { | 416 void MostVisitedSites::OnPopularSitesDownloaded(bool success) { |
417 if (!success) { | 417 if (!success) { |
418 LOG(WARNING) << "Download of popular sites failed"; | 418 LOG(WARNING) << "Download of popular sites failed"; |
419 return; | 419 return; |
420 } | 420 } |
421 | |
422 for (const PopularSites::Site& popular_site : popular_sites_->sites()) { | |
423 // Ignore callback; these icons will be seen on the *next* NTP. | |
424 icon_cacher_->StartFetch(popular_site, | |
Marc Treib
2017/02/27 12:33:35
Hrm. So if the NTP gets closed in the meantime, th
sfiera
2017/02/27 12:51:33
Yes. But that's already true of PopularSites as a
fhorschig
2017/02/27 15:40:28
+1 to making MVS/PS long-lived.
(Maybe not in this
| |
425 base::Bind([](bool newly_available) {})); | |
Marc Treib
2017/02/27 12:33:35
Can we just pass a null Callback here?
sfiera
2017/02/27 12:51:33
Do you mean to change the signature of StartFetch(
Marc Treib
2017/02/27 13:09:35
No, I mean just passing "PopularSites::FinishedCal
fhorschig
2017/02/27 15:40:28
Agree to the readability but I think it's more lik
| |
426 } | |
421 } | 427 } |
422 | 428 |
423 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url, | 429 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url, |
424 bool newly_available) { | 430 bool newly_available) { |
425 if (newly_available) | 431 if (newly_available) |
426 observer_->OnIconMadeAvailable(site_url); | 432 observer_->OnIconMadeAvailable(site_url); |
427 } | 433 } |
428 | 434 |
429 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} | 435 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} |
430 | 436 |
431 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, | 437 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
432 ChangeReason change_reason) { | 438 ChangeReason change_reason) { |
433 if (mv_source_ == NTPTileSource::TOP_SITES) { | 439 if (mv_source_ == NTPTileSource::TOP_SITES) { |
434 // The displayed tiles are invalidated. | 440 // The displayed tiles are invalidated. |
435 InitiateTopSitesQuery(); | 441 InitiateTopSitesQuery(); |
436 } | 442 } |
437 } | 443 } |
438 | 444 |
439 } // namespace ntp_tiles | 445 } // namespace ntp_tiles |
OLD | NEW |