Index: components/ntp_tiles/most_visited_sites.cc |
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc |
index 19c2f957f89efe1f1a5b08014a72b494071f9f95..81fe916f97cc8630a5f1c5b0c018cff7b77c8fe4 100644 |
--- a/components/ntp_tiles/most_visited_sites.cc |
+++ b/components/ntp_tiles/most_visited_sites.cc |
@@ -52,15 +52,13 @@ MostVisitedSites::MostVisitedSites( |
SuggestionsService* suggestions, |
std::unique_ptr<PopularSites> popular_sites, |
std::unique_ptr<IconCacher> icon_cacher, |
- std::unique_ptr<MostVisitedSitesSupervisor> supervisor, |
- std::unique_ptr<HomePageClient> home_page_client) |
+ std::unique_ptr<MostVisitedSitesSupervisor> supervisor) |
: prefs_(prefs), |
top_sites_(top_sites), |
suggestions_service_(suggestions), |
popular_sites_(std::move(popular_sites)), |
icon_cacher_(std::move(icon_cacher)), |
supervisor_(std::move(supervisor)), |
- home_page_client_(std::move(home_page_client)), |
observer_(nullptr), |
num_sites_(0u), |
top_sites_observer_(this), |
@@ -74,21 +72,6 @@ MostVisitedSites::MostVisitedSites( |
supervisor_->SetObserver(this); |
} |
-MostVisitedSites::MostVisitedSites( |
- PrefService* prefs, |
- scoped_refptr<history::TopSites> top_sites, |
- SuggestionsService* suggestions, |
- std::unique_ptr<PopularSites> popular_sites, |
- std::unique_ptr<IconCacher> icon_cacher, |
- std::unique_ptr<MostVisitedSitesSupervisor> supervisor) |
- : MostVisitedSites(prefs, |
- top_sites, |
- suggestions, |
- std::move(popular_sites), |
- std::move(icon_cacher), |
- std::move(supervisor), |
- nullptr) {} |
- |
MostVisitedSites::~MostVisitedSites() { |
if (supervisor_) |
supervisor_->SetObserver(nullptr); |
@@ -111,6 +94,12 @@ bool MostVisitedSites::DoesSourceExist(TileSource source) const { |
return false; |
} |
+void MostVisitedSites::SetHomePageClient( |
+ std::unique_ptr<HomePageClient> client) { |
+ DCHECK(client); |
+ home_page_client_ = std::move(client); |
+} |
+ |
void MostVisitedSites::SetMostVisitedURLsObserver(Observer* observer, |
size_t num_sites) { |
DCHECK(observer); |
@@ -491,9 +480,11 @@ void MostVisitedSites::TopSitesChanged(TopSites* top_sites, |
bool MostVisitedSites::ShouldAddHomeTile() const { |
return base::FeatureList::IsEnabled(kPinHomePageAsTileFeature) && |
- num_sites_ > 0u && home_page_client_ && |
+ num_sites_ > 0u && |
+ home_page_client_ && // No platform-specific implementation - no tile. |
home_page_client_->IsHomePageEnabled() && |
!home_page_client_->IsNewTabPageUsedAsHomePage() && |
+ !home_page_client_->GetHomepageUrl().is_empty() && |
!(top_sites_ && |
top_sites_->IsBlacklisted(home_page_client_->GetHomepageUrl())); |
} |