Index: chrome/browser/history/top_sites_service.cc |
diff --git a/chrome/browser/history/top_sites_impl.cc b/chrome/browser/history/top_sites_service.cc |
similarity index 84% |
copy from chrome/browser/history/top_sites_impl.cc |
copy to chrome/browser/history/top_sites_service.cc |
index ba422eeef1502295ed52669de5e4224b25502e9a..3e5dec7598ba3c171e2fd16665451820c6fe5970 100644 |
--- a/chrome/browser/history/top_sites_impl.cc |
+++ b/chrome/browser/history/top_sites_service.cc |
@@ -1,8 +1,8 @@ |
-// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/history/top_sites_impl.h" |
+#include "chrome/browser/history/top_sites_service.h" |
#include <algorithm> |
#include <set> |
@@ -53,7 +53,7 @@ namespace { |
void RunOrPostGetMostVisitedURLsCallback( |
base::TaskRunner* task_runner, |
bool include_forced_urls, |
- const TopSitesImpl::GetMostVisitedURLsCallback& callback, |
+ const TopSitesService::GetMostVisitedURLsCallback& callback, |
const MostVisitedURLList& all_urls, |
const MostVisitedURLList& nonforced_urls) { |
const MostVisitedURLList* urls = |
@@ -95,7 +95,7 @@ static const int64 kMaxUpdateIntervalMinutes = 60; |
// artifacts for these small sized, highly detailed images. |
static const int kTopSitesImageQuality = 100; |
-TopSitesImpl::TopSitesImpl(Profile* profile) |
+TopSitesService::TopSitesService(Profile* profile) |
: backend_(NULL), |
cache_(new TopSitesCache()), |
thread_safe_cache_(new TopSitesCache()), |
@@ -115,25 +115,24 @@ TopSitesImpl::TopSitesImpl(Profile* profile) |
} |
for (int i = 0; i < kPrepopulatedPagesCount; i++) { |
int url_id = kPrepopulatedPages[i].url_id; |
- prepopulated_page_urls_.push_back( |
- GURL(l10n_util::GetStringUTF8(url_id))); |
+ prepopulated_page_urls_.push_back(GURL(l10n_util::GetStringUTF8(url_id))); |
} |
} |
-void TopSitesImpl::Init(const base::FilePath& db_name) { |
+void TopSitesService::Init(const base::FilePath& db_name) { |
// Create the backend here, rather than in the constructor, so that |
// unit tests that do not need the backend can run without a problem. |
backend_ = new TopSitesBackend; |
backend_->Init(db_name); |
backend_->GetMostVisitedThumbnails( |
- base::Bind(&TopSitesImpl::OnGotMostVisitedThumbnails, |
+ base::Bind(&TopSitesService::OnGotMostVisitedThumbnails, |
base::Unretained(this)), |
&cancelable_task_tracker_); |
} |
-bool TopSitesImpl::SetPageThumbnail(const GURL& url, |
- const gfx::Image& thumbnail, |
- const ThumbnailScore& score) { |
+bool TopSitesService::SetPageThumbnail(const GURL& url, |
+ const gfx::Image& thumbnail, |
+ const ThumbnailScore& score) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if (!loaded_) { |
@@ -169,7 +168,7 @@ bool TopSitesImpl::SetPageThumbnail(const GURL& url, |
return SetPageThumbnailEncoded(url, thumbnail_data.get(), score); |
} |
-bool TopSitesImpl::SetPageThumbnailToJPEGBytes( |
+bool TopSitesService::SetPageThumbnailToJPEGBytes( |
const GURL& url, |
const base::RefCountedMemory* memory, |
const ThumbnailScore& score) { |
@@ -205,7 +204,7 @@ bool TopSitesImpl::SetPageThumbnailToJPEGBytes( |
} |
// WARNING: this function may be invoked on any thread. |
-void TopSitesImpl::GetMostVisitedURLs( |
+void TopSitesService::GetMostVisitedURLs( |
const GetMostVisitedURLsCallback& callback, |
bool include_forced_urls) { |
MostVisitedURLList filtered_urls; |
@@ -214,25 +213,23 @@ void TopSitesImpl::GetMostVisitedURLs( |
if (!loaded_) { |
// A request came in before we finished loading. Store the callback and |
// we'll run it on current thread when we finish loading. |
- pending_callbacks_.push_back( |
- base::Bind(&RunOrPostGetMostVisitedURLsCallback, |
- base::MessageLoopProxy::current(), |
- include_forced_urls, |
- callback)); |
+ pending_callbacks_.push_back(base::Bind( |
+ &RunOrPostGetMostVisitedURLsCallback, |
+ base::MessageLoopProxy::current(), include_forced_urls, callback)); |
return; |
} |
if (include_forced_urls) { |
filtered_urls = thread_safe_cache_->top_sites(); |
} else { |
filtered_urls.assign(thread_safe_cache_->top_sites().begin() + |
- thread_safe_cache_->GetNumForcedURLs(), |
+ thread_safe_cache_->GetNumForcedURLs(), |
thread_safe_cache_->top_sites().end()); |
} |
} |
callback.Run(filtered_urls); |
} |
-bool TopSitesImpl::GetPageThumbnail( |
+bool TopSitesService::GetPageThumbnail( |
const GURL& url, |
bool prefix_match, |
scoped_refptr<base::RefCountedMemory>* bytes) { |
@@ -247,10 +244,9 @@ bool TopSitesImpl::GetPageThumbnail( |
// Resource bundle is thread safe. |
for (int i = 0; i < kPrepopulatedPagesCount; i++) { |
if (url == prepopulated_page_urls_[i]) { |
- *bytes = ResourceBundle::GetSharedInstance(). |
- LoadDataResourceBytesForScale( |
- kPrepopulatedPages[i].thumbnail_id, |
- ui::SCALE_FACTOR_100P); |
+ *bytes = |
+ ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
+ kPrepopulatedPages[i].thumbnail_id, ui::SCALE_FACTOR_100P); |
return true; |
} |
} |
@@ -279,15 +275,15 @@ bool TopSitesImpl::GetPageThumbnail( |
return false; |
} |
-bool TopSitesImpl::GetPageThumbnailScore(const GURL& url, |
- ThumbnailScore* score) { |
+bool TopSitesService::GetPageThumbnailScore(const GURL& url, |
+ ThumbnailScore* score) { |
// WARNING: this may be invoked on any thread. |
base::AutoLock lock(lock_); |
return thread_safe_cache_->GetPageThumbnailScore(url, score); |
} |
-bool TopSitesImpl::GetTemporaryPageThumbnailScore(const GURL& url, |
- ThumbnailScore* score) { |
+bool TopSitesService::GetTemporaryPageThumbnailScore(const GURL& url, |
+ ThumbnailScore* score) { |
for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end(); |
++i) { |
if (i->first == url) { |
@@ -298,7 +294,6 @@ bool TopSitesImpl::GetTemporaryPageThumbnailScore(const GURL& url, |
return false; |
} |
- |
// Returns the index of |url| in |urls|, or -1 if not found. |
static int IndexOf(const MostVisitedURLList& urls, const GURL& url) { |
for (size_t i = 0; i < urls.size(); i++) { |
@@ -308,7 +303,7 @@ static int IndexOf(const MostVisitedURLList& urls, const GURL& url) { |
return -1; |
} |
-void TopSitesImpl::SyncWithHistory() { |
+void TopSitesService::SyncWithHistory() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
if (loaded_ && temp_images_.size()) { |
// If we have temporary thumbnails it means there isn't much data, and most |
@@ -321,13 +316,13 @@ void TopSitesImpl::SyncWithHistory() { |
} |
} |
-bool TopSitesImpl::HasBlacklistedItems() const { |
+bool TopSitesService::HasBlacklistedItems() const { |
const base::DictionaryValue* blacklist = |
profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist); |
return blacklist && !blacklist->empty(); |
} |
-void TopSitesImpl::AddBlacklistedURL(const GURL& url) { |
+void TopSitesService::AddBlacklistedURL(const GURL& url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
base::Value* dummy = base::Value::CreateNullValue(); |
@@ -342,7 +337,7 @@ void TopSitesImpl::AddBlacklistedURL(const GURL& url) { |
NotifyTopSitesChanged(); |
} |
-void TopSitesImpl::RemoveBlacklistedURL(const GURL& url) { |
+void TopSitesService::RemoveBlacklistedURL(const GURL& url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
{ |
DictionaryPrefUpdate update(profile_->GetPrefs(), |
@@ -354,14 +349,14 @@ void TopSitesImpl::RemoveBlacklistedURL(const GURL& url) { |
NotifyTopSitesChanged(); |
} |
-bool TopSitesImpl::IsBlacklisted(const GURL& url) { |
+bool TopSitesService::IsBlacklisted(const GURL& url) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
const base::DictionaryValue* blacklist = |
profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist); |
return blacklist && blacklist->HasKey(GetURLHash(url)); |
} |
-void TopSitesImpl::ClearBlacklistedURLs() { |
+void TopSitesService::ClearBlacklistedURLs() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
{ |
DictionaryPrefUpdate update(profile_->GetPrefs(), |
@@ -373,7 +368,7 @@ void TopSitesImpl::ClearBlacklistedURLs() { |
NotifyTopSitesChanged(); |
} |
-void TopSitesImpl::Shutdown() { |
+void TopSitesService::Shutdown() { |
profile_ = NULL; |
// Cancel all requests so that the service doesn't callback to us after we've |
// invoked Shutdown (this could happen if we have a pending request and |
@@ -383,10 +378,9 @@ void TopSitesImpl::Shutdown() { |
} |
// static |
-void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, |
- const MostVisitedURLList& new_list, |
- TopSitesDelta* delta) { |
- |
+void TopSitesService::DiffMostVisited(const MostVisitedURLList& old_list, |
+ const MostVisitedURLList& new_list, |
+ TopSitesDelta* delta) { |
// Add all the old URLs for quick lookup. This maps URLs to the corresponding |
// index in the input. |
std::map<GURL, size_t> all_old_urls; |
@@ -421,8 +415,8 @@ void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, |
} else { |
DCHECK(found->second != kAlreadyFoundMarker) |
<< "Same URL appears twice in the new list."; |
- int old_rank = found->second >= num_old_forced ? |
- found->second - num_old_forced : -1; |
+ int old_rank = |
+ found->second >= num_old_forced ? found->second - num_old_forced : -1; |
if (old_rank != rank || |
old_list[found->second].last_forced_time != |
new_list[i].last_forced_time) { |
@@ -444,45 +438,46 @@ void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, |
} |
} |
-base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() { |
+base::CancelableTaskTracker::TaskId |
+TopSitesService::StartQueryForMostVisited() { |
DCHECK(loaded_); |
if (!profile_) |
return base::CancelableTaskTracker::kBadTaskId; |
- HistoryService* hs = HistoryServiceFactory::GetForProfile( |
- profile_, Profile::EXPLICIT_ACCESS); |
+ HistoryService* hs = |
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
// |hs| may be null during unit tests. |
if (hs) { |
return hs->QueryMostVisitedURLs( |
- num_results_to_request_from_history(), |
- kDaysOfHistory, |
- base::Bind(&TopSitesImpl::OnTopSitesAvailableFromHistory, |
+ num_results_to_request_from_history(), kDaysOfHistory, |
+ base::Bind(&TopSitesService::OnTopSitesAvailableFromHistory, |
base::Unretained(this)), |
&cancelable_task_tracker_); |
} |
return base::CancelableTaskTracker::kBadTaskId; |
} |
-bool TopSitesImpl::IsKnownURL(const GURL& url) { |
+bool TopSitesService::IsKnownURL(const GURL& url) { |
return loaded_ && cache_->IsKnownURL(url); |
} |
-const std::string& TopSitesImpl::GetCanonicalURLString(const GURL& url) const { |
+const std::string& TopSitesService::GetCanonicalURLString( |
+ const GURL& url) const { |
return cache_->GetCanonicalURL(url).spec(); |
} |
-bool TopSitesImpl::IsNonForcedFull() { |
+bool TopSitesService::IsNonForcedFull() { |
return loaded_ && cache_->GetNumNonForcedURLs() >= kNonForcedTopSitesNumber; |
} |
-bool TopSitesImpl::IsForcedFull() { |
+bool TopSitesService::IsForcedFull() { |
return loaded_ && cache_->GetNumForcedURLs() >= kForcedTopSitesNumber; |
} |
-TopSitesImpl::~TopSitesImpl() { |
+TopSitesService::~TopSitesService() { |
} |
-bool TopSitesImpl::SetPageThumbnailNoDB( |
+bool TopSitesService::SetPageThumbnailNoDB( |
const GURL& url, |
const base::RefCountedMemory* thumbnail_data, |
const ThumbnailScore& score) { |
@@ -512,7 +507,7 @@ bool TopSitesImpl::SetPageThumbnailNoDB( |
return true; |
} |
-bool TopSitesImpl::SetPageThumbnailEncoded( |
+bool TopSitesService::SetPageThumbnailEncoded( |
const GURL& url, |
const base::RefCountedMemory* thumbnail, |
const ThumbnailScore& score) { |
@@ -526,15 +521,15 @@ bool TopSitesImpl::SetPageThumbnailEncoded( |
size_t index = cache_->GetURLIndex(url); |
int url_rank = index - cache_->GetNumForcedURLs(); |
const MostVisitedURL& most_visited = cache_->top_sites()[index]; |
- backend_->SetPageThumbnail(most_visited, |
- url_rank < 0 ? -1 : url_rank, |
+ backend_->SetPageThumbnail(most_visited, url_rank < 0 ? -1 : url_rank, |
*(cache_->GetImage(most_visited.url))); |
return true; |
} |
// static |
-bool TopSitesImpl::EncodeBitmap(const gfx::Image& bitmap, |
- scoped_refptr<base::RefCountedBytes>* bytes) { |
+bool TopSitesService::EncodeBitmap( |
+ const gfx::Image& bitmap, |
+ scoped_refptr<base::RefCountedBytes>* bytes) { |
if (bitmap.IsEmpty()) |
return false; |
*bytes = new base::RefCountedBytes(); |
@@ -549,7 +544,7 @@ bool TopSitesImpl::EncodeBitmap(const gfx::Image& bitmap, |
return true; |
} |
-void TopSitesImpl::RemoveTemporaryThumbnailByURL(const GURL& url) { |
+void TopSitesService::RemoveTemporaryThumbnailByURL(const GURL& url) { |
for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end(); |
++i) { |
if (i->first == url) { |
@@ -559,7 +554,7 @@ void TopSitesImpl::RemoveTemporaryThumbnailByURL(const GURL& url) { |
} |
} |
-void TopSitesImpl::AddTemporaryThumbnail( |
+void TopSitesService::AddTemporaryThumbnail( |
const GURL& url, |
const base::RefCountedMemory* thumbnail, |
const ThumbnailScore& score) { |
@@ -573,13 +568,14 @@ void TopSitesImpl::AddTemporaryThumbnail( |
temp_images_.push_back(image); |
} |
-void TopSitesImpl::TimerFired() { |
+void TopSitesService::TimerFired() { |
StartQueryForMostVisited(); |
} |
// static |
-int TopSitesImpl::GetRedirectDistanceForURL(const MostVisitedURL& most_visited, |
- const GURL& url) { |
+int TopSitesService::GetRedirectDistanceForURL( |
+ const MostVisitedURL& most_visited, |
+ const GURL& url) { |
for (size_t i = 0; i < most_visited.redirects.size(); i++) { |
if (most_visited.redirects[i] == url) |
return static_cast<int>(most_visited.redirects.size() - i - 1); |
@@ -588,7 +584,7 @@ int TopSitesImpl::GetRedirectDistanceForURL(const MostVisitedURL& most_visited, |
return 0; |
} |
-MostVisitedURLList TopSitesImpl::GetPrepopulatePages() { |
+MostVisitedURLList TopSitesService::GetPrepopulatePages() { |
MostVisitedURLList urls; |
urls.resize(kPrepopulatedPagesCount); |
for (int i = 0; i < kPrepopulatedPagesCount; ++i) { |
@@ -600,11 +596,11 @@ MostVisitedURLList TopSitesImpl::GetPrepopulatePages() { |
return urls; |
} |
-bool TopSitesImpl::loaded() const { |
+bool TopSitesService::loaded() const { |
return loaded_; |
} |
-bool TopSitesImpl::AddForcedURL(const GURL& url, const base::Time& time) { |
+bool TopSitesService::AddForcedURL(const GURL& url, const base::Time& time) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
size_t num_forced = cache_->GetNumForcedURLs(); |
MostVisitedURLList new_list(cache_->top_sites()); |
@@ -637,8 +633,8 @@ bool TopSitesImpl::AddForcedURL(const GURL& url, const base::Time& time) { |
return true; |
} |
-bool TopSitesImpl::AddPrepopulatedPages(MostVisitedURLList* urls, |
- size_t num_forced_urls) { |
+bool TopSitesService::AddPrepopulatedPages(MostVisitedURLList* urls, |
+ size_t num_forced_urls) { |
bool added = false; |
MostVisitedURLList prepopulate_urls = GetPrepopulatePages(); |
for (size_t i = 0; i < prepopulate_urls.size(); ++i) { |
@@ -651,7 +647,7 @@ bool TopSitesImpl::AddPrepopulatedPages(MostVisitedURLList* urls, |
return added; |
} |
-size_t TopSitesImpl::MergeCachedForcedURLs(MostVisitedURLList* new_list) { |
+size_t TopSitesService::MergeCachedForcedURLs(MostVisitedURLList* new_list) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
// Add all the new URLs for quick lookup. Take that opportunity to count the |
// number of forced URLs in |new_list|. |
@@ -676,9 +672,9 @@ size_t TopSitesImpl::MergeCachedForcedURLs(MostVisitedURLList* new_list) { |
// Prepend forced URLs and sort in order of ascending |last_forced_time|. |
new_list->insert(new_list->begin(), filtered_forced_urls.begin(), |
filtered_forced_urls.end()); |
- std::inplace_merge( |
- new_list->begin(), new_list->begin() + filtered_forced_urls.size(), |
- new_list->begin() + num_forced, ForcedURLComparator); |
+ std::inplace_merge(new_list->begin(), |
+ new_list->begin() + filtered_forced_urls.size(), |
+ new_list->begin() + num_forced, ForcedURLComparator); |
// Drop older forced URLs if the list overflows. Since forced URLs are always |
// sort in increasing order of |last_forced_time|, drop the first ones. |
@@ -691,15 +687,15 @@ size_t TopSitesImpl::MergeCachedForcedURLs(MostVisitedURLList* new_list) { |
return num_forced; |
} |
-void TopSitesImpl::ApplyBlacklist(const MostVisitedURLList& urls, |
- MostVisitedURLList* out) { |
+void TopSitesService::ApplyBlacklist(const MostVisitedURLList& urls, |
+ MostVisitedURLList* out) { |
// Log the number of times ApplyBlacklist is called so we can compute the |
// average number of blacklisted items per user. |
const base::DictionaryValue* blacklist = |
profile_->GetPrefs()->GetDictionary(prefs::kNtpMostVisitedURLsBlacklist); |
UMA_HISTOGRAM_BOOLEAN("TopSites.NumberOfApplyBlacklist", true); |
UMA_HISTOGRAM_COUNTS_100("TopSites.NumberOfBlacklistedItems", |
- (blacklist ? blacklist->size() : 0)); |
+ (blacklist ? blacklist->size() : 0)); |
size_t num_non_forced_urls = 0; |
size_t num_forced_urls = 0; |
for (size_t i = 0; i < urls.size(); ++i) { |
@@ -720,25 +716,25 @@ void TopSitesImpl::ApplyBlacklist(const MostVisitedURLList& urls, |
} |
} |
-std::string TopSitesImpl::GetURLHash(const GURL& url) { |
+std::string TopSitesService::GetURLHash(const GURL& url) { |
// We don't use canonical URLs here to be able to blacklist only one of |
// the two 'duplicate' sites, e.g. 'gmail.com' and 'mail.google.com'. |
return base::MD5String(url.spec()); |
} |
-base::TimeDelta TopSitesImpl::GetUpdateDelay() { |
+base::TimeDelta TopSitesService::GetUpdateDelay() { |
if (cache_->top_sites().size() <= kPrepopulatedPagesCount) |
return base::TimeDelta::FromSeconds(30); |
int64 range = kMaxUpdateIntervalMinutes - kMinUpdateIntervalMinutes; |
int64 minutes = kMaxUpdateIntervalMinutes - |
- last_num_urls_changed_ * range / cache_->top_sites().size(); |
+ last_num_urls_changed_ * range / cache_->top_sites().size(); |
return base::TimeDelta::FromMinutes(minutes); |
} |
-void TopSitesImpl::Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
+void TopSitesService::Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) { |
if (!loaded_) |
return; |
@@ -786,7 +782,7 @@ void TopSitesImpl::Observe(int type, |
} |
} |
-void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites) { |
+void TopSitesService::SetTopSites(const MostVisitedURLList& new_top_sites) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
MostVisitedURLList top_sites(new_top_sites); |
@@ -816,8 +812,8 @@ void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites) { |
for (TempImages::iterator it = temp_images_.begin(); |
it != temp_images_.end(); ++it) { |
if (canonical_url == cache_->GetCanonicalURL(it->first)) { |
- SetPageThumbnailEncoded( |
- mv.url, it->second.thumbnail.get(), it->second.thumbnail_score); |
+ SetPageThumbnailEncoded(mv.url, it->second.thumbnail.get(), |
+ it->second.thumbnail_score); |
temp_images_.erase(it); |
break; |
} |
@@ -837,7 +833,7 @@ void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites) { |
RestartQueryForTopSitesTimer(GetUpdateDelay()); |
} |
-int TopSitesImpl::num_results_to_request_from_history() const { |
+int TopSitesService::num_results_to_request_from_history() const { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
const base::DictionaryValue* blacklist = |
@@ -845,7 +841,7 @@ int TopSitesImpl::num_results_to_request_from_history() const { |
return kNonForcedTopSitesNumber + (blacklist ? blacklist->size() : 0); |
} |
-void TopSitesImpl::MoveStateToLoaded() { |
+void TopSitesService::MoveStateToLoaded() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
MostVisitedURLList filtered_urls_all; |
@@ -865,7 +861,7 @@ void TopSitesImpl::MoveStateToLoaded() { |
// are not interested in them. |
filtered_urls_all = thread_safe_cache_->top_sites(); |
filtered_urls_nonforced.assign(thread_safe_cache_->top_sites().begin() + |
- thread_safe_cache_->GetNumForcedURLs(), |
+ thread_safe_cache_->GetNumForcedURLs(), |
thread_safe_cache_->top_sites().end()); |
pending_callbacks.swap(pending_callbacks_); |
} |
@@ -877,19 +873,19 @@ void TopSitesImpl::MoveStateToLoaded() { |
NotifyTopSitesLoaded(); |
} |
-void TopSitesImpl::ResetThreadSafeCache() { |
+void TopSitesService::ResetThreadSafeCache() { |
base::AutoLock lock(lock_); |
MostVisitedURLList cached; |
ApplyBlacklist(cache_->top_sites(), &cached); |
thread_safe_cache_->SetTopSites(cached); |
} |
-void TopSitesImpl::ResetThreadSafeImageCache() { |
+void TopSitesService::ResetThreadSafeImageCache() { |
base::AutoLock lock(lock_); |
thread_safe_cache_->SetThumbnails(cache_->images()); |
} |
-void TopSitesImpl::RestartQueryForTopSitesTimer(base::TimeDelta delta) { |
+void TopSitesService::RestartQueryForTopSitesTimer(base::TimeDelta delta) { |
if (timer_.IsRunning() && ((timer_start_time_ + timer_.GetCurrentDelay()) < |
(base::TimeTicks::Now() + delta))) { |
return; |
@@ -897,10 +893,10 @@ void TopSitesImpl::RestartQueryForTopSitesTimer(base::TimeDelta delta) { |
timer_start_time_ = base::TimeTicks::Now(); |
timer_.Stop(); |
- timer_.Start(FROM_HERE, delta, this, &TopSitesImpl::TimerFired); |
+ timer_.Start(FROM_HERE, delta, this, &TopSitesService::TimerFired); |
} |
-void TopSitesImpl::OnGotMostVisitedThumbnails( |
+void TopSitesService::OnGotMostVisitedThumbnails( |
const scoped_refptr<MostVisitedThumbnails>& thumbnails) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
@@ -919,7 +915,7 @@ void TopSitesImpl::OnGotMostVisitedThumbnails( |
base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); |
} |
-void TopSitesImpl::OnTopSitesAvailableFromHistory( |
+void TopSitesService::OnTopSitesAvailableFromHistory( |
const MostVisitedURLList* pages) { |
DCHECK(pages); |
SetTopSites(*pages); |