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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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_login_handler.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 bf78cd0540a8b9bc919465796ad41bb93f9eae66..159a06d16dfcc7b96c96605fa50dd6a41d8cbed9 100644
--- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc
+++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc
@@ -249,13 +249,6 @@ 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("ntp.setBookmarkBarAttached", attached);
- break;
- }
#if defined(ENABLE_THEMES)
case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: {
InitializeCSSCaches();
@@ -288,6 +281,14 @@ void NewTabUI::Observe(int type,
}
}
+void NewTabUI::OnPreferenceChanged(PrefServiceBase* service,
+ const std::string& pref_name) {
+ StringValue attached(
+ GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ?
+ "true" : "false");
+ web_ui()->CallJavascriptFunction("ntp.setBookmarkBarAttached", attached);
+}
+
void NewTabUI::InitializeCSSCaches() {
#if defined(ENABLE_THEMES)
Profile* profile = GetProfile();
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.h ('k') | chrome/browser/ui/webui/ntp/ntp_login_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698