OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prefs/pref_notifier_impl.h" | 5 #include "chrome/browser/prefs/pref_notifier_impl.h" |
6 | 6 |
7 #include "base/logging.h" | |
Bernhard Bauer
2012/06/19 01:12:56
This doesn't seem necessary.
| |
7 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
10 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
11 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
12 | 13 |
13 PrefNotifierImpl::PrefNotifierImpl() | 14 PrefNotifierImpl::PrefNotifierImpl() |
14 : pref_service_(NULL) { | 15 : pref_service_(NULL) { |
15 } | 16 } |
16 | 17 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 if (!pref_service_->FindPreference(path.c_str())) | 96 if (!pref_service_->FindPreference(path.c_str())) |
96 return; | 97 return; |
97 | 98 |
98 const PrefObserverMap::iterator observer_iterator = | 99 const PrefObserverMap::iterator observer_iterator = |
99 pref_observers_.find(path); | 100 pref_observers_.find(path); |
100 if (observer_iterator == pref_observers_.end()) | 101 if (observer_iterator == pref_observers_.end()) |
101 return; | 102 return; |
102 | 103 |
103 NotificationObserverList::Iterator it(*(observer_iterator->second)); | 104 NotificationObserverList::Iterator it(*(observer_iterator->second)); |
104 content::NotificationObserver* observer; | 105 content::NotificationObserver* observer; |
106 | |
105 while ((observer = it.GetNext()) != NULL) { | 107 while ((observer = it.GetNext()) != NULL) { |
106 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, | 108 observer->Observe(chrome::NOTIFICATION_PREF_CHANGED, |
107 content::Source<PrefService>(pref_service_), | 109 content::Source<PrefService>(pref_service_), |
108 content::Details<const std::string>(&path)); | 110 content::Details<const std::string>(&path)); |
109 } | 111 } |
110 } | 112 } |
111 | 113 |
112 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) { | 114 void PrefNotifierImpl::SetPrefService(PrefService* pref_service) { |
113 DCHECK(pref_service_ == NULL); | 115 DCHECK(pref_service_ == NULL); |
114 pref_service_ = pref_service; | 116 pref_service_ = pref_service; |
115 } | 117 } |
OLD | NEW |