| Index: chrome/browser/ui/webui/ntp/suggestions_page_handler.cc
|
| diff --git a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc
|
| index 4d606fe2d0c02ebc3797f0e909e93accedd24cf1..2689c20e21f22b1e44fe47594ab1afa111b51ebc 100644
|
| --- a/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc
|
| +++ b/chrome/browser/ui/webui/ntp/suggestions_page_handler.cc
|
| @@ -15,7 +15,6 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/threading/thread.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/chrome_notification_types.h"
|
| #include "chrome/browser/history/top_sites.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/ui/webui/favicon_source.h"
|
| @@ -28,7 +27,6 @@
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "content/public/browser/navigation_controller.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| -#include "content/public/browser/notification_source.h"
|
| #include "content/public/browser/url_data_source.h"
|
| #include "content/public/browser/user_metrics.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -39,7 +37,8 @@
|
| using base::UserMetricsAction;
|
|
|
| SuggestionsHandler::SuggestionsHandler()
|
| - : got_first_suggestions_request_(false),
|
| + : scoped_observer_(this),
|
| + got_first_suggestions_request_(false),
|
| suggestions_viewed_(false),
|
| user_action_logged_(false) {
|
| }
|
| @@ -76,10 +75,9 @@ void SuggestionsHandler::RegisterMessages() {
|
| // show the new tab page.
|
| top_sites->SyncWithHistory();
|
|
|
| - // Register for notification when TopSites changes so that we can update
|
| - // ourself.
|
| - registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED,
|
| - content::Source<history::TopSites>(top_sites));
|
| + // Register as TopSitesObserver so that we can update ourselves when the
|
| + // TopSites changes.
|
| + scoped_observer_.Add(top_sites);
|
| }
|
|
|
| // Setup the suggestions sources.
|
| @@ -175,11 +173,10 @@ void SuggestionsHandler::HandleSuggestedSitesSelected(
|
| suggestions_viewed_ = true;
|
| }
|
|
|
| -void SuggestionsHandler::Observe(int type,
|
| - const content::NotificationSource& source,
|
| - const content::NotificationDetails& details) {
|
| - DCHECK_EQ(type, chrome::NOTIFICATION_TOP_SITES_CHANGED);
|
| +void SuggestionsHandler::TopSitesLoaded(history::TopSites* top_sites) {
|
| +}
|
|
|
| +void SuggestionsHandler::TopSitesChanged(history::TopSites* top_sites) {
|
| // Suggestions urls changed, query again.
|
| suggestions_combiner_->FetchItems(Profile::FromWebUI(web_ui()));
|
| }
|
|
|