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

Unified Diff: chrome/browser/thumbnails/thumbnail_service_impl.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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/thumbnails/thumbnail_service_impl.cc
diff --git a/chrome/browser/thumbnails/thumbnail_service_impl.cc b/chrome/browser/thumbnails/thumbnail_service_impl.cc
index 8f572d39b14994962831bcaef78b10eaf32e672e..bf3e1eeb79a3ba1f06bc1bd31281c5ca5349bc68 100644
--- a/chrome/browser/thumbnails/thumbnail_service_impl.cc
+++ b/chrome/browser/thumbnails/thumbnail_service_impl.cc
@@ -8,6 +8,7 @@
#include "base/memory/ref_counted_memory.h"
#include "base/time/time.h"
#include "chrome/browser/history/history_service.h"
+#include "chrome/browser/history/top_sites_service_factory.h"
#include "chrome/browser/thumbnails/content_based_thumbnailing_algorithm.h"
#include "chrome/browser/thumbnails/simple_thumbnail_crop.h"
#include "chrome/browser/thumbnails/thumbnailing_context.h"
@@ -33,12 +34,13 @@ bool IsThumbnailRetargetingEnabled() {
switches::kEnableThumbnailRetargeting);
}
-void AddForcedURLOnUIThread(scoped_refptr<history::TopSites> top_sites,
- const GURL& url) {
+void AddForcedURLOnUIThread(
+ scoped_refptr<history::TopSitesProvider> top_sites_provider,
+ const GURL& url) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (top_sites.get() != NULL)
- top_sites->AddForcedURL(url, base::Time::Now());
+ if (top_sites_provider.get() != NULL)
+ top_sites_provider->AddForcedURL(url, base::Time::Now());
}
} // namespace
@@ -46,7 +48,7 @@ void AddForcedURLOnUIThread(scoped_refptr<history::TopSites> top_sites,
namespace thumbnails {
ThumbnailServiceImpl::ThumbnailServiceImpl(Profile* profile)
- : top_sites_(profile->GetTopSites()),
+ : top_sites_provider(TopSitesServiceFactory::GetForProfile(profile)),
use_thumbnail_retargeting_(IsThumbnailRetargetingEnabled()) {
}
@@ -55,7 +57,7 @@ ThumbnailServiceImpl::~ThumbnailServiceImpl() {
bool ThumbnailServiceImpl::SetPageThumbnail(const ThumbnailingContext& context,
const gfx::Image& thumbnail) {
- scoped_refptr<history::TopSites> local_ptr(top_sites_);
+ scoped_refptr<history::TopSitesProvider> local_ptr(top_sites_provider);
if (local_ptr.get() == NULL)
return false;
@@ -66,7 +68,7 @@ bool ThumbnailServiceImpl::GetPageThumbnail(
const GURL& url,
bool prefix_match,
scoped_refptr<base::RefCountedMemory>* bytes) {
- scoped_refptr<history::TopSites> local_ptr(top_sites_);
+ scoped_refptr<history::TopSitesProvider> local_ptr(top_sites_provider);
if (local_ptr.get() == NULL)
return false;
@@ -74,7 +76,7 @@ bool ThumbnailServiceImpl::GetPageThumbnail(
}
void ThumbnailServiceImpl::AddForcedURL(const GURL& url) {
- scoped_refptr<history::TopSites> local_ptr(top_sites_);
+ scoped_refptr<history::TopSitesProvider> local_ptr(top_sites_provider);
if (local_ptr.get() == NULL)
return;
@@ -92,7 +94,7 @@ ThumbnailingAlgorithm* ThumbnailServiceImpl::GetThumbnailingAlgorithm()
}
bool ThumbnailServiceImpl::ShouldAcquirePageThumbnail(const GURL& url) {
- scoped_refptr<history::TopSites> local_ptr(top_sites_);
+ scoped_refptr<history::TopSitesProvider> local_ptr(top_sites_provider);
if (local_ptr.get() == NULL)
return false;
@@ -122,7 +124,7 @@ void ThumbnailServiceImpl::ShutdownOnUIThread() {
// Since each call uses its own scoped_refptr, we can just clear the reference
// here by assigning null. If another call is completed, it added its own
// reference.
- top_sites_ = NULL;
+ top_sites_provider = NULL;
}
} // namespace thumbnails

Powered by Google App Engine
This is Rietveld 408576698