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

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

Issue 11348165: Remove PrefObserver usages, batch 10. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android 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
Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index 5b2a045b7fdcb0b88fc1a3af6ec98ca57df1ce15..94f0bef5a56537458b06534f2a47bdc071b3f7c4 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -175,12 +175,15 @@ NTPResourceCache::NTPResourceCache(Profile* profile)
registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
content::NotificationService::AllSources());
+ base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged,
+ base::Unretained(this));
+
// Watch for pref changes that cause us to need to invalidate the HTML cache.
pref_change_registrar_.Init(profile_->GetPrefs());
- pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, this);
- pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
- pref_change_registrar_.Add(prefs::kNtpShownPage, this);
- pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this);
+ pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback);
+ pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback);
+ pref_change_registrar_.Add(prefs::kNtpShownPage, callback);
+ pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback);
}
NTPResourceCache::~NTPResourceCache() {}
@@ -227,8 +230,8 @@ base::RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
}
void NTPResourceCache::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
// Invalidate the cache.
if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type ||
chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) {
@@ -241,8 +244,7 @@ void NTPResourceCache::Observe(int type,
}
}
-void NTPResourceCache::OnPreferenceChanged(PrefServiceBase* service,
- const std::string& pref_name) {
+void NTPResourceCache::OnPreferenceChanged() {
Mattias Nissler (ping if slow) 2012/11/21 09:39:34 nit: This function should be named FlushCache.
Dan Beam 2012/11/22 00:32:49 FYI: you may notice there are various things that
// A change occurred to one of the preferences we care about, so flush the
// cache.
new_tab_incognito_html_ = NULL;
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.h ('k') | chrome/browser/ui/webui/ntp/ntp_resource_cache_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698