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

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

Issue 2920773002: Enable Home Page tile by default for Chrome Home. (Closed)
Patch Set: Remove feature constant completely Created 3 years, 6 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
« no previous file with comments | « components/ntp_tiles/constants.cc ('k') | components/ntp_tiles/most_visited_sites_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 472
473 void MostVisitedSites::TopSitesChanged(TopSites* top_sites, 473 void MostVisitedSites::TopSitesChanged(TopSites* top_sites,
474 ChangeReason change_reason) { 474 ChangeReason change_reason) {
475 if (mv_source_ == TileSource::TOP_SITES) { 475 if (mv_source_ == TileSource::TOP_SITES) {
476 // The displayed tiles are invalidated. 476 // The displayed tiles are invalidated.
477 InitiateTopSitesQuery(); 477 InitiateTopSitesQuery();
478 } 478 }
479 } 479 }
480 480
481 bool MostVisitedSites::ShouldAddHomeTile() const { 481 bool MostVisitedSites::ShouldAddHomeTile() const {
482 return base::FeatureList::IsEnabled(kPinHomePageAsTileFeature) && 482 return num_sites_ > 0u &&
483 num_sites_ > 0u &&
484 home_page_client_ && // No platform-specific implementation - no tile. 483 home_page_client_ && // No platform-specific implementation - no tile.
485 home_page_client_->IsHomePageEnabled() && 484 home_page_client_->IsHomePageEnabled() &&
486 !home_page_client_->IsNewTabPageUsedAsHomePage() && 485 !home_page_client_->IsNewTabPageUsedAsHomePage() &&
487 !home_page_client_->GetHomepageUrl().is_empty() && 486 !home_page_client_->GetHomepageUrl().is_empty() &&
488 !(top_sites_ && 487 !(top_sites_ &&
489 top_sites_->IsBlacklisted(home_page_client_->GetHomepageUrl())); 488 top_sites_->IsBlacklisted(home_page_client_->GetHomepageUrl()));
490 } 489 }
491 490
492 void MostVisitedSites::AddToHostsAndTotalCount(const NTPTilesVector& new_tiles, 491 void MostVisitedSites::AddToHostsAndTotalCount(const NTPTilesVector& new_tiles,
493 std::set<std::string>* hosts, 492 std::set<std::string>* hosts,
494 size_t* total_tile_count) const { 493 size_t* total_tile_count) const {
495 for (const auto& tile : new_tiles) { 494 for (const auto& tile : new_tiles) {
496 hosts->insert(tile.url.host()); 495 hosts->insert(tile.url.host());
497 } 496 }
498 *total_tile_count += new_tiles.size(); 497 *total_tile_count += new_tiles.size();
499 DCHECK_LE(*total_tile_count, num_sites_); 498 DCHECK_LE(*total_tile_count, num_sites_);
500 } 499 }
501 500
502 } // namespace ntp_tiles 501 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « components/ntp_tiles/constants.cc ('k') | components/ntp_tiles/most_visited_sites_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698