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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 | 413 |
414 observer_->OnMostVisitedURLsAvailable(current_tiles_); | 414 observer_->OnMostVisitedURLsAvailable(current_tiles_); |
415 } | 415 } |
416 | 416 |
417 void MostVisitedSites::OnPopularSitesDownloaded(bool success) { | 417 void MostVisitedSites::OnPopularSitesDownloaded(bool success) { |
418 if (!success) { | 418 if (!success) { |
419 LOG(WARNING) << "Download of popular sites failed"; | 419 LOG(WARNING) << "Download of popular sites failed"; |
420 return; | 420 return; |
421 } | 421 } |
422 | 422 |
423 // Re-build the tile list. Once done, this will notify the observer. | 423 // Only build the tiles if there haven't been any. Otherwise, the UI should |
424 BuildCurrentTiles(); | 424 // not flicker. |
425 if (current_tiles_.empty()) { | |
sfiera
2017/02/09 12:39:06
Can this actually happen? For a new user, we shoul
fhorschig
2017/02/09 15:30:18
Removed completely.
| |
426 // Re-build the tile list. Once done, this will notify the observer. | |
427 BuildCurrentTiles(); | |
428 } | |
425 } | 429 } |
426 | 430 |
427 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url, | 431 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url, |
428 bool newly_available) { | 432 bool newly_available) { |
429 if (newly_available) | 433 if (newly_available) |
430 observer_->OnIconMadeAvailable(site_url); | 434 observer_->OnIconMadeAvailable(site_url); |
431 } | 435 } |
432 | 436 |
433 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} | 437 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} |
434 | 438 |
435 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, | 439 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
436 ChangeReason change_reason) { | 440 ChangeReason change_reason) { |
437 if (mv_source_ == NTPTileSource::TOP_SITES) { | 441 if (mv_source_ == NTPTileSource::TOP_SITES) { |
438 // The displayed tiles are invalidated. | 442 // The displayed tiles are invalidated. |
439 InitiateTopSitesQuery(); | 443 InitiateTopSitesQuery(); |
440 } | 444 } |
441 } | 445 } |
442 | 446 |
443 } // namespace ntp_tiles | 447 } // namespace ntp_tiles |
OLD | NEW |