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

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: 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/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72242cd70e61608229385255cb48a50647404260..8abdf7a1a81c219033af5b68ccb7dc0f5a4b5b96 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,14 @@ 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) &&
Evan Stade 2011/10/04 21:10:38 only 4 spaces
Joao da Silva 2011/10/05 14:31:25 Done.
+ !prefs->GetBoolean(prefs::kShowBookmarkBar) &&
+ !NTP4BookmarkFeaturesEnabled();
+}
+
void NewTabUI::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -312,15 +312,12 @@ 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()) {
Evan Stade 2011/10/04 21:10:38 don't add curlies
Joao da Silva 2011/10/05 14:31:25 Done.
CallJavascriptFunction("bookmarkBarAttached");
- else
+ } else {
CallJavascriptFunction("bookmarkBarDetached");
+ }
}
break;
}
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698