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

Unified Diff: chrome/browser/ui/webui/ntp/suggestions_page_handler.h

Issue 845013002: Remove TopSites notification in favor of Observers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months 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/ui/webui/ntp/suggestions_page_handler.h
diff --git a/chrome/browser/ui/webui/ntp/suggestions_page_handler.h b/chrome/browser/ui/webui/ntp/suggestions_page_handler.h
index 8871c62fab9af2e82e822a6282133bd2e1cb43ad..8f23fd3ba84ef86a795fe4771bb61573bebbc83d 100644
--- a/chrome/browser/ui/webui/ntp/suggestions_page_handler.h
+++ b/chrome/browser/ui/webui/ntp/suggestions_page_handler.h
@@ -7,10 +7,10 @@
#include <string>
+#include "base/scoped_observer.h"
#include "chrome/browser/ui/webui/ntp/suggestions_combiner.h"
#include "components/history/core/browser/history_types.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
+#include "components/history/core/browser/top_sites_observer.h"
#include "content/public/browser/web_ui_message_handler.h"
class GURL;
@@ -32,8 +32,8 @@ class PrefRegistrySyncable;
// is a dictionary for quick access (it associates a dummy boolean to the URL
// string).
class SuggestionsHandler : public content::WebUIMessageHandler,
- public content::NotificationObserver,
- public SuggestionsCombiner::Delegate {
+ public SuggestionsCombiner::Delegate,
+ public history::TopSitesObserver {
public:
SuggestionsHandler();
~SuggestionsHandler() override;
@@ -59,10 +59,9 @@ class SuggestionsHandler : public content::WebUIMessageHandler,
// Callback for the "suggestedSitesSelected" message.
void HandleSuggestedSitesSelected(const base::ListValue* args);
- // content::NotificationObserver implementation.
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
+ // history::TopSitesObserver implementation.
+ void TopSitesLoaded(history::TopSites* top_sites) override;
+ void TopSitesChanged(history::TopSites* top_sites) override;
// SuggestionsCombiner::Delegate implementation.
void OnSuggestionsReady() override;
@@ -79,7 +78,8 @@ class SuggestionsHandler : public content::WebUIMessageHandler,
// Sends pages_value_ to the javascript side to and resets page_value_.
void SendPagesValue();
- content::NotificationRegistrar registrar_;
+ // Scoped observer to help with TopSitesObserver registration.
+ ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_;
// We pre-fetch the first set of result pages. This variable is false until
// we get the first getSuggestions() call.
« no previous file with comments | « chrome/browser/ui/webui/ntp/most_visited_handler.cc ('k') | chrome/browser/ui/webui/ntp/suggestions_page_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698