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

Unified Diff: chrome/browser/ui/webui/ntp/most_visited_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/most_visited_handler.h
diff --git a/chrome/browser/ui/webui/ntp/most_visited_handler.h b/chrome/browser/ui/webui/ntp/most_visited_handler.h
index 7f304922dba8d557039f2841d4842ae54ef28787..2ccc25b2a1e61034828d461ee9bab79401ab80cd 100644
--- a/chrome/browser/ui/webui/ntp/most_visited_handler.h
+++ b/chrome/browser/ui/webui/ntp/most_visited_handler.h
@@ -9,9 +9,9 @@
#include <vector>
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.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;
@@ -33,7 +33,7 @@ class PrefRegistrySyncable;
// is a dictionary for quick access (it associates a dummy boolean to the URL
// string).
class MostVisitedHandler : public content::WebUIMessageHandler,
- public content::NotificationObserver {
+ public history::TopSitesObserver {
public:
MostVisitedHandler();
@@ -60,11 +60,6 @@ class MostVisitedHandler : public content::WebUIMessageHandler,
// Callback for the "mostVisitedSelected" message.
void HandleMostVisitedSelected(const base::ListValue* args);
- // content::NotificationObserver implementation.
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
const std::vector<GURL>& most_visited_urls() const {
return most_visited_urls_;
}
@@ -92,7 +87,12 @@ class MostVisitedHandler : public content::WebUIMessageHandler,
// Sends pages_value_ to the javascript side and resets page_value_.
void SendPagesValue();
- content::NotificationRegistrar registrar_;
+ // history::TopSitesObserver implementation.
+ void TopSitesLoaded(history::TopSites* top_sites) override;
+ void TopSitesChanged(history::TopSites* top_sites) override;
+
+ // Scoped observer to help with TopSitesObserver registration.
+ ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_;
// The most visited URLs, in priority order.
// Only used for matching up clicks on the page to which most visited entry
« no previous file with comments | « chrome/browser/ui/views/frame/global_menu_bar_x11.cc ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698