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

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

Issue 8135001: Fixed behavior of the bookmark bar visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_EQ instead of DCHECK 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
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_tab_helper.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index acebb2522f34fdb59cf934a9afc9dad4fcbf4d4d..f83aaa923e3fcd9afc2165d6976a2800c2ede6aa 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -144,6 +144,7 @@
#include "content/browser/user_metrics.h"
#include "content/common/content_restriction.h"
#include "content/common/content_switches.h"
+#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "content/common/page_transition_types.h"
#include "content/common/page_zoom.h"
@@ -304,11 +305,6 @@ Browser::Browser(Type type, Profile* profile)
Source<ThemeService>(ThemeServiceFactory::GetForProfile(profile_)));
registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENT_SETTINGS_CHANGED,
NotificationService::AllSources());
- // We listen to all notification sources because the bookmark bar
- // state needs to stay in sync between the incognito and normal profiles.
- registrar_.Add(this,
- chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllBrowserContextsAndSources());
// Need to know when to alert the user of theme install delay.
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_READY_FOR_INSTALL,
@@ -325,7 +321,7 @@ Browser::Browser(Type type, Profile* profile)
profile_pref_registrar_.Init(profile_->GetPrefs());
profile_pref_registrar_.Add(prefs::kDevToolsDisabled, this);
profile_pref_registrar_.Add(prefs::kEditBookmarksEnabled, this);
- profile_pref_registrar_.Add(prefs::kEnableBookmarkBar, this);
+ profile_pref_registrar_.Add(prefs::kShowBookmarkBar, this);
profile_pref_registrar_.Add(prefs::kHomePage, this);
profile_pref_registrar_.Add(prefs::kInstantEnabled, this);
profile_pref_registrar_.Add(prefs::kIncognitoModeAvailability, this);
@@ -2273,9 +2269,6 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kEnableTranslate,
true,
PrefService::SYNCABLE_PREF);
- prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar,
- true,
- PrefService::UNSYNCABLE_PREF);
prefs->RegisterStringPref(prefs::kCloudPrintEmail,
std::string(),
PrefService::UNSYNCABLE_PREF);
@@ -4087,8 +4080,9 @@ void Browser::Observe(int type,
g_browser_process->devtools_manager()->CloseAllClientHosts();
} else if (pref_name == prefs::kEditBookmarksEnabled) {
UpdateCommandsForBookmarkEditing();
- } else if (pref_name == prefs::kEnableBookmarkBar) {
+ } else if (pref_name == prefs::kShowBookmarkBar) {
UpdateCommandsForBookmarkBar();
+ UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
} else if (pref_name == prefs::kHomePage) {
PrefService* pref_service = Source<PrefService>(source).ptr();
MarkHomePageAsChanged(pref_service);
@@ -4115,11 +4109,6 @@ void Browser::Observe(int type,
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
break;
- case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
- if (profile_->IsSameProfile(Source<Profile>(source).ptr()))
- UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
- break;
-
default:
NOTREACHED() << "Got a notification we didn't register for.";
}
@@ -4553,7 +4542,7 @@ void Browser::UpdateCommandsForBookmarkBar() {
#endif
command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR,
browser_defaults::bookmarks_enabled &&
- !profile_->GetPrefs()->IsManagedPreference(prefs::kEnableBookmarkBar) &&
+ !profile_->GetPrefs()->IsManagedPreference(prefs::kShowBookmarkBar) &&
show_main_ui);
}
@@ -5214,8 +5203,8 @@ int Browser::GetContentRestrictionsForSelectedTab() {
void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) {
BookmarkBar::State state;
// The bookmark bar is hidden in fullscreen mode, unless on the new tab page.
- if ((profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) &&
- profile_->GetPrefs()->GetBoolean(prefs::kEnableBookmarkBar)) &&
+ if (browser_defaults::bookmarks_enabled &&
+ profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) &&
(!window_ || !window_->IsFullscreen())) {
state = BookmarkBar::SHOW;
} else {
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_tab_helper.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698