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

Unified Diff: chrome/browser/ui/gtk/global_menu_bar.cc

Issue 7548022: Profiles: Introduce AllProfilesAndSources(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avi fixes Created 9 years, 5 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/global_menu_bar.cc
diff --git a/chrome/browser/ui/gtk/global_menu_bar.cc b/chrome/browser/ui/gtk/global_menu_bar.cc
index 4fd937f7b630c62bf4d58e6cd49b3afc91f47a51..4bfd2bd0631a3bb37dc3840ce293939f56e95eef 100644
--- a/chrome/browser/ui/gtk/global_menu_bar.cc
+++ b/chrome/browser/ui/gtk/global_menu_bar.cc
@@ -18,6 +18,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/common/notification_service.h"
+#include "content/common/notification_source.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/gtk_util.h"
@@ -213,12 +214,12 @@ GlobalMenuBar::GlobalMenuBar(Browser* browser)
}
// Listen for bookmark bar visibility changes and set the initial state.
+ Source<Profile> source(browser->profile());
registrar_.Add(this,
chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
+ source);
Observe(chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
+ source, NotificationService::NoDetails());
}
GlobalMenuBar::~GlobalMenuBar() {
@@ -232,13 +233,14 @@ void GlobalMenuBar::Disable() {
browser_->command_updater()->RemoveCommandObserver(it->first, this);
}
id_to_menu_item_.clear();
+ Source<Profile> source(browser_->profile());
if (registrar_.IsRegistered(this,
chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources())) {
+ source)) {
registrar_.Remove(
this,
chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
+ source);
}
}
@@ -318,7 +320,8 @@ void GlobalMenuBar::EnabledStateChangedForCommand(int id, bool enabled) {
void GlobalMenuBar::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(type == chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED);
+ DCHECK_EQ(type, chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED);
+ DCHECK_EQ(Source<Profile>(source).ptr(), browser_->profile());
CommandIDMenuItemMap::iterator it =
id_to_menu_item_.find(IDC_SHOW_BOOKMARK_BAR);
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698