Chromium Code Reviews| 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..60060448a2d5039507427f04def66232d52ef04e 100644 |
| --- a/components/ntp_tiles/most_visited_sites.cc |
| +++ b/components/ntp_tiles/most_visited_sites.cc |
| @@ -52,15 +52,14 @@ 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)), |
| + home_page_client_(nullptr), |
|
mastiz
2017/06/01 08:18:44
Nit: no need for this line, unique_ptr constructs
fhorschig
2017/06/01 10:12:56
Gone.
|
| observer_(nullptr), |
| num_sites_(0u), |
| top_sites_observer_(this), |
| @@ -74,21 +73,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 +95,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); |
| @@ -494,6 +484,7 @@ bool MostVisitedSites::ShouldAddHomeTile() const { |
| num_sites_ > 0u && home_page_client_ && |
| home_page_client_->IsHomePageEnabled() && |
| !home_page_client_->IsNewTabPageUsedAsHomePage() && |
| + !home_page_client_->GetHomepageUrl().is_empty() && |
|
mastiz
2017/06/01 08:18:44
For safety, check for home_page_client_ being nonn
fhorschig
2017/06/01 10:12:56
Added a comment to make this existing check more v
mastiz
2017/06/01 10:59:24
Oop, sorry, I totally missed the fact that it pred
|
| !(top_sites_ && |
| top_sites_->IsBlacklisted(home_page_client_->GetHomepageUrl())); |
| } |