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"); |