| 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..31b68d6fd76e44fe86b706559255f50e5f94f57d 100644
|
| --- a/chrome/browser/search/instant_service.cc
|
| +++ b/chrome/browser/search/instant_service.cc
|
| @@ -93,11 +93,8 @@ InstantService::InstantService(Profile* profile)
|
| 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));
|
| - }
|
| + if (top_sites)
|
| + top_sites->AddObserver(this);
|
|
|
| if (profile_ && profile_->GetResourceContext()) {
|
| content::BrowserThread::PostTask(
|
| @@ -206,6 +203,11 @@ void InstantService::Shutdown() {
|
| base::Bind(&InstantIOContext::ClearInstantProcessesOnIO,
|
| instant_io_context_));
|
| }
|
| +
|
| + history::TopSites* top_sites = profile_->GetTopSites();
|
| + if (top_sites)
|
| + top_sites->RemoveObserver(this);
|
| +
|
| instant_io_context_ = NULL;
|
| }
|
|
|
| @@ -221,15 +223,6 @@ void InstantService::Observe(int type,
|
| OnRendererProcessTerminated(
|
| 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(
|
| - base::Bind(&InstantService::OnMostVisitedItemsReceived,
|
| - weak_ptr_factory_.GetWeakPtr()), false);
|
| - }
|
| - break;
|
| - }
|
| #if defined(ENABLE_THEMES)
|
| case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
|
| OnThemeChanged(content::Source<ThemeService>(source).ptr());
|
| @@ -423,6 +416,16 @@ void InstantService::OnTemplateURLServiceChanged() {
|
| }
|
| }
|
|
|
| +void InstantService::TopSitesLoaded(history::TopSites* top_sites) {
|
| +}
|
| +
|
| +void InstantService::TopSitesChanged(history::TopSites* top_sites) {
|
| + top_sites->GetMostVisitedURLs(
|
| + base::Bind(&InstantService::OnMostVisitedItemsReceived,
|
| + weak_ptr_factory_.GetWeakPtr()),
|
| + false);
|
| +}
|
| +
|
| void InstantService::ResetInstantSearchPrerenderer() {
|
| if (!chrome::ShouldPrefetchSearchResults())
|
| return;
|
|
|