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

Unified Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2897293002: Adding CrHome-specific implementation for home page tile. (Closed)
Patch Set: Refactor tests and initialization Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | components/ntp_tiles/most_visited_sites_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
}
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | components/ntp_tiles/most_visited_sites_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698