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

Unified Diff: chrome/browser/dom_ui/ntp_resource_cache.cc

Issue 3304015: Use PrefChangeRegistrar everywhere (Closed)
Patch Set: final version for commit Created 10 years, 3 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/dom_ui/ntp_resource_cache.h ('k') | chrome/browser/dom_ui/shown_sections_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/ntp_resource_cache.cc
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 600710f314a0dff78f5648d9fbf52372a3711bdf..bd7ff3758d2306031bc5f8ed87c07153eb2b4a87 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -133,15 +133,9 @@ NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {
NotificationService::AllSources());
// Watch for pref changes that cause us to need to invalidate the HTML cache.
- PrefService* pref_service = profile_->GetPrefs();
- pref_service->AddPrefObserver(prefs::kShowBookmarkBar, this);
- pref_service->AddPrefObserver(prefs::kNTPShownSections, this);
-}
-
-NTPResourceCache::~NTPResourceCache() {
- PrefService* pref_service = profile_->GetPrefs();
- pref_service->RemovePrefObserver(prefs::kShowBookmarkBar, this);
- pref_service->RemovePrefObserver(prefs::kNTPShownSections, this);
+ pref_change_registrar_.Init(profile_->GetPrefs());
+ pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
+ pref_change_registrar_.Add(prefs::kNTPShownSections, this);
}
RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_off_the_record) {
« no previous file with comments | « chrome/browser/dom_ui/ntp_resource_cache.h ('k') | chrome/browser/dom_ui/shown_sections_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698