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

Unified Diff: chrome/browser/ui/views/frame/global_menu_bar_x11.cc

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/views/frame/global_menu_bar_x11.cc
diff --git a/chrome/browser/ui/views/frame/global_menu_bar_x11.cc b/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
index a19b2c3aba8f64d1b7c0c390bdb482a92e3ddea5..69606c60b9d9302046844c6e0d346592e2736fba 100644
--- a/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
+++ b/chrome/browser/ui/views/frame/global_menu_bar_x11.cc
@@ -16,7 +16,6 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h"
@@ -32,7 +31,6 @@
#include "chrome/browser/ui/views/frame/global_menu_bar_registrar_x11.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
-#include "content/public/browser/notification_source.h"
#include "ui/base/accelerators/menu_label_accelerator_util_linux.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
@@ -334,6 +332,7 @@ GlobalMenuBarX11::GlobalMenuBarX11(BrowserView* browser_view,
profiles_menu_(nullptr),
top_sites_(nullptr),
tab_restore_service_(nullptr),
+ scoped_observer_(this),
weak_ptr_factory_(this) {
EnsureMethodsLoaded();
@@ -430,10 +429,9 @@ void GlobalMenuBarX11::InitServer(unsigned long xid) {
if (top_sites_) {
GetTopSitesData();
- // 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_);
}
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -728,14 +726,11 @@ void GlobalMenuBarX11::EnabledStateChangedForCommand(int id, bool enabled) {
menuitem_property_set_bool(it->second, kPropertyEnabled, enabled);
}
-void GlobalMenuBarX11::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- if (type == chrome::NOTIFICATION_TOP_SITES_CHANGED) {
+void GlobalMenuBarX11::TopSitesLoaded(history::TopSites* top_sites) {
+}
+
+void GlobalMenuBarX11::TopSitesChanged(history::TopSites* top_sites) {
GetTopSitesData();
- } else {
- NOTREACHED();
- }
}
void GlobalMenuBarX11::TabRestoreServiceChanged(TabRestoreService* service) {
« no previous file with comments | « chrome/browser/ui/views/frame/global_menu_bar_x11.h ('k') | chrome/browser/ui/webui/ntp/most_visited_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698