| Index: chrome/browser/search/instant_service.cc
|
| diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
|
| index 1144e405f7885dd2572749e7fd40575caf337fa9..8ffabe7dce81cb4652360bed88e9a4d614e2f87f 100644
|
| --- a/chrome/browser/search/instant_service.cc
|
| +++ b/chrome/browser/search/instant_service.cc
|
| @@ -5,7 +5,8 @@
|
| #include "chrome/browser/search/instant_service.h"
|
|
|
| #include "chrome/browser/chrome_notification_types.h"
|
| -#include "chrome/browser/history/top_sites.h"
|
| +#include "chrome/browser/history/top_sites_provider.h"
|
| +#include "chrome/browser/history/top_sites_service_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/search/instant_io_context.h"
|
| #include "chrome/browser/search/instant_service_observer.h"
|
| @@ -92,11 +93,12 @@ InstantService::InstantService(Profile* profile)
|
| content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
|
| content::NotificationService::AllSources());
|
|
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| - if (top_sites) {
|
| - registrar_.Add(this,
|
| - chrome::NOTIFICATION_TOP_SITES_CHANGED,
|
| - content::Source<history::TopSites>(top_sites));
|
| + history::TopSitesProvider* top_sites_provider =
|
| + TopSitesServiceFactory::GetForProfile(profile_);
|
| + if (top_sites_provider) {
|
| + registrar_.Add(
|
| + this, chrome::NOTIFICATION_TOP_SITES_CHANGED,
|
| + content::Source<history::TopSitesProvider>(top_sites_provider));
|
| }
|
|
|
| if (profile_ && profile_->GetResourceContext()) {
|
| @@ -161,27 +163,30 @@ void InstantService::RemoveObserver(InstantServiceObserver* observer) {
|
| }
|
|
|
| void InstantService::DeleteMostVisitedItem(const GURL& url) {
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| - if (!top_sites)
|
| + history::TopSitesProvider* top_sites_provider =
|
| + TopSitesServiceFactory::GetForProfile(profile_);
|
| + if (!top_sites_provider)
|
| return;
|
|
|
| - top_sites->AddBlacklistedURL(url);
|
| + top_sites_provider->AddBlacklistedURL(url);
|
| }
|
|
|
| void InstantService::UndoMostVisitedDeletion(const GURL& url) {
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| - if (!top_sites)
|
| + history::TopSitesProvider* top_sites_provider =
|
| + TopSitesServiceFactory::GetForProfile(profile_);
|
| + if (!top_sites_provider)
|
| return;
|
|
|
| - top_sites->RemoveBlacklistedURL(url);
|
| + top_sites_provider->RemoveBlacklistedURL(url);
|
| }
|
|
|
| void InstantService::UndoAllMostVisitedDeletions() {
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| - if (!top_sites)
|
| + history::TopSitesProvider* top_sites_provider =
|
| + TopSitesServiceFactory::GetForProfile(profile_);
|
| + if (!top_sites_provider)
|
| return;
|
|
|
| - top_sites->ClearBlacklistedURLs();
|
| + top_sites_provider->ClearBlacklistedURLs();
|
| }
|
|
|
| void InstantService::UpdateThemeInfo() {
|
| @@ -222,11 +227,13 @@ void InstantService::Observe(int type,
|
| content::Source<content::RenderProcessHost>(source)->GetID());
|
| break;
|
| case chrome::NOTIFICATION_TOP_SITES_CHANGED: {
|
| - history::TopSites* top_sites = profile_->GetTopSites();
|
| - if (top_sites) {
|
| - top_sites->GetMostVisitedURLs(
|
| + history::TopSitesProvider* top_sites_provider =
|
| + TopSitesServiceFactory::GetForProfile(profile_);
|
| + if (top_sites_provider) {
|
| + top_sites_provider->GetMostVisitedURLs(
|
| base::Bind(&InstantService::OnMostVisitedItemsReceived,
|
| - weak_ptr_factory_.GetWeakPtr()), false);
|
| + weak_ptr_factory_.GetWeakPtr()),
|
| + false);
|
| }
|
| break;
|
| }
|
|
|