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

Unified Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 8135001: Fixed behavior of the bookmark bar visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewed, rebased 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/webui/ntp/new_tab_ui.cc
diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
index c1453b12061ea30a83da026803aa50499224cdde..c9f9e35e7a899f38025038ae6247dc8842903644 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -6,8 +6,6 @@
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
-#include <set>
-
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
@@ -195,12 +193,6 @@ NewTabUI::NewTabUI(TabContents* contents)
// Override some options on the Web UI.
hide_favicon_ = true;
- if (!NTP4BookmarkFeaturesEnabled() &&
- GetProfile()->GetPrefs()->GetBoolean(prefs::kEnableBookmarkBar) &&
- browser_defaults::bookmarks_enabled) {
- set_force_bookmark_bar_visible(true);
- }
-
focus_location_bar_by_default_ = true;
should_hide_url_ = true;
overridden_title_ = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
@@ -297,6 +289,15 @@ void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) {
StartTimingPaint(render_view_host);
}
+bool NewTabUI::IsBookmarkBarVisible() const {
+ const PrefService* prefs = GetProfile()->GetPrefs();
+ return
+ browser_defaults::bookmarks_enabled &&
+ !prefs->IsManagedPreference(prefs::kShowBookmarkBar) &&
+ !prefs->GetBoolean(prefs::kShowBookmarkBar) &&
+ !NTP4BookmarkFeaturesEnabled();
sky 2011/10/05 16:59:12 I don't think this should check kShowBookmarkBar.
Joao da Silva 2011/10/06 19:45:38 Yikes, totally forgot to check behavior with fulls
+}
+
void NewTabUI::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -312,12 +313,8 @@ void NewTabUI::Observe(int type,
break;
}
case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: {
- if (GetProfile()->GetPrefs()->IsManagedPreference(
- prefs::kEnableBookmarkBar)) {
- break;
- }
if (!NTP4Enabled()) {
- if (GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar))
+ if (IsBookmarkBarVisible())
CallJavascriptFunction("bookmarkBarAttached");
else
CallJavascriptFunction("bookmarkBarDetached");

Powered by Google App Engine
This is Rietveld 408576698