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

Unified Diff: chrome/browser/prefs/pref_set_observer.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/prefs/pref_set_observer.h ('k') | chrome/browser/profile_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_set_observer.cc
diff --git a/chrome/browser/prefs/pref_set_observer.cc b/chrome/browser/prefs/pref_set_observer.cc
index a4ecf6ffe9eac4f2c1eaf8969a7cb06006012664..dd067d3aac05e6c851227212586aec515c17b2aa 100644
--- a/chrome/browser/prefs/pref_set_observer.cc
+++ b/chrome/browser/prefs/pref_set_observer.cc
@@ -11,23 +11,19 @@ PrefSetObserver::PrefSetObserver(PrefService* pref_service,
NotificationObserver* observer)
: pref_service_(pref_service),
observer_(observer) {
-}
-
-PrefSetObserver::~PrefSetObserver() {
- for (PrefSet::const_iterator i(prefs_.begin()); i != prefs_.end(); ++i)
- pref_service_->RemovePrefObserver(i->c_str(), this);
+ registrar_.Init(pref_service);
}
void PrefSetObserver::AddPref(const std::string& pref) {
if (!prefs_.count(pref) && pref_service_->FindPreference(pref.c_str())) {
prefs_.insert(pref);
- pref_service_->AddPrefObserver(pref.c_str(), this);
+ registrar_.Add(pref.c_str(), this);
}
}
void PrefSetObserver::RemovePref(const std::string& pref) {
if (prefs_.erase(pref))
- pref_service_->RemovePrefObserver(pref.c_str(), this);
+ registrar_.Remove(pref.c_str(), this);
}
bool PrefSetObserver::IsObserved(const std::string& pref) {
« no previous file with comments | « chrome/browser/prefs/pref_set_observer.h ('k') | chrome/browser/profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698