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

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

Issue 9477018: retry r123804 - ntp theme fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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 fe80f87cd8011e89ddd40a72a1eb23d945fdd3fc..2a5e29571cc7656e9472e122dcc608cb46505c4c 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -133,6 +133,8 @@ NewTabUI::NewTabUI(content::WebUI* web_ui)
new NewTabHTMLSource(GetProfile()->GetOriginalProfile());
GetProfile()->GetChromeURLDataManager()->AddDataSource(html_source);
+ pref_change_registrar_.Init(GetProfile()->GetPrefs());
+ pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
// Listen for theme installation.
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
@@ -197,14 +199,19 @@ void NewTabUI::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
+ case chrome::NOTIFICATION_PREF_CHANGED: { // kShowBookmarkBar
+ StringValue attached(
+ GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ?
+ "true" : "false");
+ web_ui()->CallJavascriptFunction("ntp4.setBookmarkBarAttached", attached);
+ break;
+ }
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
InitializeCSSCaches();
- ListValue args;
- args.Append(Value::CreateStringValue(
+ StringValue attribution(
ThemeServiceFactory::GetForProfile(GetProfile())->HasCustomImage(
- IDR_THEME_NTP_ATTRIBUTION) ?
- "true" : "false"));
- web_ui()->CallJavascriptFunction("themeChanged", args);
+ IDR_THEME_NTP_ATTRIBUTION) ? "true" : "false");
+ web_ui()->CallJavascriptFunction("themeChanged", attribution);
break;
}
case content::NOTIFICATION_RENDER_WIDGET_HOST_DID_PAINT: {
@@ -244,7 +251,6 @@ void NewTabUI::SetupFieldTrials() {
g_hint_group = trial->AppendGroup("PlusIcon", 40);
}
-
// static
bool NewTabUI::ShouldShowWebStoreFooterLink() {
const CommandLine* cli = CommandLine::ForCurrentProcess();

Powered by Google App Engine
This is Rietveld 408576698