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

Unified Diff: chrome/browser/android/most_visited_sites.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra inclusion from testing_profile.h Created 5 years, 11 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
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 5b57d4bc856922bb35593eb833851b2a04f66142..886c8226d0cade7ee3c5a5fabe0cd7f2e1e74d10 100644
--- a/chrome/browser/android/most_visited_sites.cc
+++ b/chrome/browser/android/most_visited_sites.cc
@@ -19,6 +19,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.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"
@@ -230,7 +231,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.
@@ -238,7 +240,7 @@ void MostVisitedSites::SetMostVisitedURLsObserver(JNIEnv* env,
// Register as TopSitesObserver so that we can update ourselves when the
// TopSites changes.
- scoped_observer_.Add(top_sites);
+ scoped_observer_.Add(top_sites.get());
}
}
@@ -253,7 +255,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.
@@ -286,7 +288,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;
@@ -363,7 +366,7 @@ void MostVisitedSites::QueryMostVisitedURLs() {
}
void MostVisitedSites::InitiateTopSitesQuery() {
- TopSites* top_sites = profile_->GetTopSites();
+ scoped_refptr<TopSites> top_sites = TopSitesFactory::GetForProfile(profile_);
if (!top_sites)
return;
« no previous file with comments | « chrome/browser/android/dev_tools_server.cc ('k') | chrome/browser/android/provider/chrome_browser_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698