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

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 8135001: Fixed behavior of the bookmark bar visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mac build Created 9 years, 2 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/cocoa/browser_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 9d7105f03805054672072a8df7a2766481c1363d..507ce925285de2bc15c1f6450f1da282b6605341 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -43,6 +43,7 @@
#include "chrome/common/pref_names.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/common/native_web_keyboard_event.h"
+#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -74,14 +75,12 @@ BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
: browser_(browser),
controller_(controller),
confirm_close_factory_(browser) {
- // Listen for bookmark bar visibility changes and set the initial state; we
- // need to listen to all profiles because of normal profile/incognito issues.
- registrar_.Add(this,
- chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_SIDEBAR_CHANGED,
Source<SidebarManager>(SidebarManager::GetInstance()));
+ pref_change_registrar_.Init(browser_->profile()->GetPrefs());
+ pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
+
initial_show_state_ = browser_->GetSavedWindowShowState();
}
@@ -558,12 +557,14 @@ void BrowserWindowCocoa::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
switch (type) {
- // Only the key window gets a direct toggle from the menu.
- // Other windows hear about it from the notification.
- case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
- if (browser_->profile()->IsSameProfile(Source<Profile>(source).ptr()))
+ case chrome::NOTIFICATION_PREF_CHANGED: {
+ const std::string& pref_name = *Details<std::string>(details).ptr();
+ if (pref_name == prefs::kShowBookmarkBar)
Miranda Callahan 2011/10/06 21:10:21 Maybe change this if statement to just a DCHECK(pr
Joao da Silva 2011/10/07 09:12:31 Done.
[controller_ updateBookmarkBarVisibilityWithAnimation:YES];
+ else
+ NOTREACHED();
break;
+ }
case chrome::NOTIFICATION_SIDEBAR_CHANGED:
UpdateSidebarForContents(
Details<SidebarContainer>(details)->tab_contents());
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698