Commit 96c03256 authored by sfiera's avatar sfiera Committed by Commit bot

Pass PopularSites ownership to MostVisitedSites.

Nothing outside of MostVisitedSites needs to use it.

Review-Url: https://codereview.chromium.org/2337893003
Cr-Commit-Position: refs/heads/master@{#418625}
parent 2a2a1fcd
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback.h" #include "base/callback.h"
#include "base/memory/ptr_util.h"
#include "chrome/browser/android/ntp/popular_sites.h" #include "chrome/browser/android/ntp/popular_sites.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/history/top_sites_factory.h" #include "chrome/browser/history/top_sites_factory.h"
...@@ -158,17 +159,17 @@ void MostVisitedSitesBridge::JavaObserver::OnPopularURLsAvailable( ...@@ -158,17 +159,17 @@ void MostVisitedSitesBridge::JavaObserver::OnPopularURLsAvailable(
MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile) MostVisitedSitesBridge::MostVisitedSitesBridge(Profile* profile)
: supervisor_(profile), : supervisor_(profile),
popular_sites_(BrowserThread::GetBlockingPool(), most_visited_(profile->GetPrefs(),
TopSitesFactory::GetForProfile(profile),
SuggestionsServiceFactory::GetForProfile(profile),
base::MakeUnique<ntp_tiles::PopularSites>(
BrowserThread::GetBlockingPool(),
profile->GetPrefs(), profile->GetPrefs(),
TemplateURLServiceFactory::GetForProfile(profile), TemplateURLServiceFactory::GetForProfile(profile),
g_browser_process->variations_service(), g_browser_process->variations_service(),
profile->GetRequestContext(), profile->GetRequestContext(),
ChromePopularSites::GetDirectory(), ChromePopularSites::GetDirectory(),
base::Bind(safe_json::SafeJsonParser::Parse)), base::Bind(safe_json::SafeJsonParser::Parse)),
most_visited_(profile->GetPrefs(),
TopSitesFactory::GetForProfile(profile),
SuggestionsServiceFactory::GetForProfile(profile),
&popular_sites_,
&supervisor_) { &supervisor_) {
// Register the thumbnails debugging page. // Register the thumbnails debugging page.
// TODO(sfiera): find thumbnails a home. They don't belong here. // TODO(sfiera): find thumbnails a home. They don't belong here.
......
...@@ -83,7 +83,6 @@ class MostVisitedSitesBridge { ...@@ -83,7 +83,6 @@ class MostVisitedSitesBridge {
}; };
SupervisorBridge supervisor_; SupervisorBridge supervisor_;
ntp_tiles::PopularSites popular_sites_;
ntp_tiles::MostVisitedSites most_visited_; ntp_tiles::MostVisitedSites most_visited_;
DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge); DISALLOW_COPY_AND_ASSIGN(MostVisitedSitesBridge);
......
...@@ -143,12 +143,12 @@ std::string GetSourceHistogramName(int source) { ...@@ -143,12 +143,12 @@ std::string GetSourceHistogramName(int source) {
MostVisitedSites::MostVisitedSites(PrefService* prefs, MostVisitedSites::MostVisitedSites(PrefService* prefs,
scoped_refptr<history::TopSites> top_sites, scoped_refptr<history::TopSites> top_sites,
SuggestionsService* suggestions, SuggestionsService* suggestions,
PopularSites* popular_sites, std::unique_ptr<PopularSites> popular_sites,
MostVisitedSitesSupervisor* supervisor) MostVisitedSitesSupervisor* supervisor)
: prefs_(prefs), : prefs_(prefs),
top_sites_(top_sites), top_sites_(top_sites),
suggestions_service_(suggestions), suggestions_service_(suggestions),
popular_sites_(popular_sites), popular_sites_(std::move(popular_sites)),
supervisor_(supervisor), supervisor_(supervisor),
observer_(nullptr), observer_(nullptr),
num_sites_(0), num_sites_(0),
......
...@@ -119,7 +119,7 @@ class MostVisitedSites : public history::TopSitesObserver, ...@@ -119,7 +119,7 @@ class MostVisitedSites : public history::TopSitesObserver,
MostVisitedSites(PrefService* prefs, MostVisitedSites(PrefService* prefs,
scoped_refptr<history::TopSites> top_sites, scoped_refptr<history::TopSites> top_sites,
suggestions::SuggestionsService* suggestions, suggestions::SuggestionsService* suggestions,
PopularSites* popular_sites, std::unique_ptr<PopularSites> popular_sites,
MostVisitedSitesSupervisor* supervisor); MostVisitedSitesSupervisor* supervisor);
~MostVisitedSites() override; ~MostVisitedSites() override;
...@@ -195,7 +195,7 @@ class MostVisitedSites : public history::TopSitesObserver, ...@@ -195,7 +195,7 @@ class MostVisitedSites : public history::TopSitesObserver,
PrefService* prefs_; PrefService* prefs_;
scoped_refptr<history::TopSites> top_sites_; scoped_refptr<history::TopSites> top_sites_;
suggestions::SuggestionsService* suggestions_service_; suggestions::SuggestionsService* suggestions_service_;
PopularSites* const popular_sites_; std::unique_ptr<PopularSites> const popular_sites_;
MostVisitedSitesSupervisor* supervisor_; MostVisitedSitesSupervisor* supervisor_;
Observer* observer_; Observer* observer_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment