OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/api/prefs/pref_change_registrar.h" | 5 #include "base/prefs/public/pref_change_registrar.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/api/prefs/pref_service_base.h" | 8 #include "base/prefs/public/pref_service_base.h" |
9 | 9 |
10 PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} | 10 PrefChangeRegistrar::PrefChangeRegistrar() : service_(NULL) {} |
11 | 11 |
12 PrefChangeRegistrar::~PrefChangeRegistrar() { | 12 PrefChangeRegistrar::~PrefChangeRegistrar() { |
13 // If you see an invalid memory access in this destructor, this | 13 // If you see an invalid memory access in this destructor, this |
14 // PrefChangeRegistrar might be subscribed to an OffTheRecordProfileImpl that | 14 // PrefChangeRegistrar might be subscribed to an OffTheRecordProfileImpl that |
15 // has been destroyed. This should not happen any more but be warned. | 15 // has been destroyed. This should not happen any more but be warned. |
16 // Feel free to contact battre@chromium.org in case this happens. | 16 // Feel free to contact battre@chromium.org in case this happens. |
17 RemoveAll(); | 17 RemoveAll(); |
18 } | 18 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool PrefChangeRegistrar::IsManaged() { | 80 bool PrefChangeRegistrar::IsManaged() { |
81 for (std::set<ObserverRegistration>::const_iterator it = observers_.begin(); | 81 for (std::set<ObserverRegistration>::const_iterator it = observers_.begin(); |
82 it != observers_.end(); ++it) { | 82 it != observers_.end(); ++it) { |
83 const PrefServiceBase::Preference* pref = | 83 const PrefServiceBase::Preference* pref = |
84 service_->FindPreference(it->first.c_str()); | 84 service_->FindPreference(it->first.c_str()); |
85 if (pref && pref->IsManaged()) | 85 if (pref && pref->IsManaged()) |
86 return true; | 86 return true; |
87 } | 87 } |
88 return false; | 88 return false; |
89 } | 89 } |
OLD | NEW |