| Index: chrome/browser/android/most_visited_sites.cc
|
| diff --git a/chrome/browser/android/most_visited_sites.cc b/chrome/browser/android/most_visited_sites.cc
|
| index ed6a5d7e6c99f021adc36875f7574bf2b4908c3b..974eda12f3404fa8f6caa29867a55bf4281f403c 100644
|
| --- a/chrome/browser/android/most_visited_sites.cc
|
| +++ b/chrome/browser/android/most_visited_sites.cc
|
| @@ -20,6 +20,7 @@
|
| #include "base/time/time.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/history/top_sites.h"
|
| +#include "chrome/browser/history/top_sites_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_android.h"
|
| #include "chrome/browser/search/suggestions/suggestions_service_factory.h"
|
| @@ -232,7 +233,8 @@ void MostVisitedSites::SetMostVisitedURLsObserver(JNIEnv* env,
|
|
|
| QueryMostVisitedURLs();
|
|
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| + scoped_refptr<history::TopSites> top_sites =
|
| + TopSitesFactory::GetForProfile(profile_);
|
| if (top_sites) {
|
| // TopSites updates itself after a delay. To ensure up-to-date results,
|
| // force an update now.
|
| @@ -241,7 +243,7 @@ void MostVisitedSites::SetMostVisitedURLsObserver(JNIEnv* env,
|
| // Register for notification when TopSites changes so that we can update
|
| // ourself.
|
| registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED,
|
| - content::Source<history::TopSites>(top_sites));
|
| + content::Source<history::TopSites>(top_sites.get()));
|
| }
|
| }
|
|
|
| @@ -256,7 +258,7 @@ void MostVisitedSites::GetURLThumbnail(JNIEnv* env,
|
| j_callback->Reset(env, j_callback_obj);
|
|
|
| std::string url_string = ConvertJavaStringToUTF8(env, url);
|
| - scoped_refptr<TopSites> top_sites(profile_->GetTopSites());
|
| + scoped_refptr<TopSites> top_sites(TopSitesFactory::GetForProfile(profile_));
|
|
|
| // If the Suggestions service is enabled and in use, create a callback to
|
| // fetch a server thumbnail from it, in case the local thumbnail is not found.
|
| @@ -276,10 +278,9 @@ void MostVisitedSites::GetURLThumbnail(JNIEnv* env,
|
|
|
| BrowserThread::PostTask(
|
| BrowserThread::DB, FROM_HERE,
|
| - base::Bind(
|
| - &GetUrlThumbnailTask, url_string, top_sites,
|
| - base::Owned(j_callback), lookup_success_callback,
|
| - lookup_failed_callback));
|
| + base::Bind(&GetUrlThumbnailTask, url_string, top_sites,
|
| + base::Owned(j_callback), lookup_success_callback,
|
| + lookup_failed_callback));
|
| }
|
|
|
| void MostVisitedSites::BlacklistUrl(JNIEnv* env,
|
| @@ -289,7 +290,8 @@ void MostVisitedSites::BlacklistUrl(JNIEnv* env,
|
|
|
| switch (mv_source_) {
|
| case TOP_SITES: {
|
| - TopSites* top_sites = profile_->GetTopSites();
|
| + scoped_refptr<TopSites> top_sites =
|
| + TopSitesFactory::GetForProfile(profile_);
|
| DCHECK(top_sites);
|
| top_sites->AddBlacklistedURL(GURL(url));
|
| break;
|
| @@ -377,16 +379,15 @@ void MostVisitedSites::QueryMostVisitedURLs() {
|
| }
|
|
|
| void MostVisitedSites::InitiateTopSitesQuery() {
|
| - TopSites* top_sites = profile_->GetTopSites();
|
| + scoped_refptr<TopSites> top_sites = TopSitesFactory::GetForProfile(profile_);
|
| if (!top_sites)
|
| return;
|
|
|
| top_sites->GetMostVisitedURLs(
|
| - base::Bind(
|
| - &MostVisitedSites::OnMostVisitedURLsAvailable,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - base::Owned(new ScopedJavaGlobalRef<jobject>(observer_)),
|
| - num_sites_),
|
| + base::Bind(&MostVisitedSites::OnMostVisitedURLsAvailable,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + base::Owned(new ScopedJavaGlobalRef<jobject>(observer_)),
|
| + num_sites_),
|
| false);
|
| }
|
|
|
|
|