Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2668943002: provide static popular sites for first run (Closed)
Patch Set: Revert test changes. Construction of PopularSites is always safe. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return; 410 return;
411 411
412 observer_->OnMostVisitedURLsAvailable(current_tiles_); 412 observer_->OnMostVisitedURLsAvailable(current_tiles_);
413 } 413 }
414 414
415 void MostVisitedSites::OnPopularSitesDownloaded(bool success) { 415 void MostVisitedSites::OnPopularSitesDownloaded(bool success) {
416 if (!success) { 416 if (!success) {
417 LOG(WARNING) << "Download of popular sites failed"; 417 LOG(WARNING) << "Download of popular sites failed";
418 return; 418 return;
419 } 419 }
420
421 // Re-build the tile list. Once done, this will notify the observer.
422 BuildCurrentTiles();
423 } 420 }
424 421
425 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url, 422 void MostVisitedSites::OnIconMadeAvailable(const GURL& site_url,
426 bool newly_available) { 423 bool newly_available) {
427 if (newly_available) 424 if (newly_available)
428 observer_->OnIconMadeAvailable(site_url); 425 observer_->OnIconMadeAvailable(site_url);
429 } 426 }
430 427
431 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {} 428 void MostVisitedSites::TopSitesLoaded(TopSites* top_sites) {}
432 429
433 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 430 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
434 ChangeReason change_reason) { 431 ChangeReason change_reason) {
435 if (mv_source_ == NTPTileSource::TOP_SITES) { 432 if (mv_source_ == NTPTileSource::TOP_SITES) {
436 // The displayed tiles are invalidated. 433 // The displayed tiles are invalidated.
437 InitiateTopSitesQuery(); 434 InitiateTopSitesQuery();
438 } 435 }
439 } 436 }
440 437
441 } // namespace ntp_tiles 438 } // namespace ntp_tiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698