Index: chrome/browser/host_zoom_map.cc |
diff --git a/chrome/browser/host_zoom_map.cc b/chrome/browser/host_zoom_map.cc |
index 0c1d96a22c998f0f2a22f7a90dd60dc92130e489..cb67a04477ab33e2f39a42d3c6259553aa37bc9e 100644 |
--- a/chrome/browser/host_zoom_map.cc |
+++ b/chrome/browser/host_zoom_map.cc |
@@ -27,8 +27,10 @@ HostZoomMap::HostZoomMap(Profile* profile) |
// Don't observe pref changes (e.g. from sync) in Incognito; once we create |
// the incognito window it should have no further connection to the main |
// profile/prefs. |
- if (!profile_->IsOffTheRecord()) |
- profile_->GetPrefs()->AddPrefObserver(prefs::kPerHostZoomLevels, this); |
+ if (!profile_->IsOffTheRecord()) { |
+ pref_change_registrar_.Init(profile_->GetPrefs()); |
+ pref_change_registrar_.Add(prefs::kPerHostZoomLevels, this); |
+ } |
} |
void HostZoomMap::Load() { |
@@ -128,7 +130,7 @@ void HostZoomMap::Shutdown() { |
NotificationType::PROFILE_DESTROYED, |
Source<Profile>(profile_)); |
if (!profile_->IsOffTheRecord()) |
- profile_->GetPrefs()->RemovePrefObserver(prefs::kPerHostZoomLevels, this); |
+ pref_change_registrar_.RemoveAll(); |
profile_ = NULL; |
} |