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 #ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_ | 5 #ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_ |
6 #define BASE_PREFS_PREF_NOTIFIER_IMPL_H_ | 6 #define BASE_PREFS_PREF_NOTIFIER_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... | |
32 void AddPrefObserver(const char* path, PrefObserver* observer); | 32 void AddPrefObserver(const char* path, PrefObserver* observer); |
33 void RemovePrefObserver(const char* path, PrefObserver* observer); | 33 void RemovePrefObserver(const char* path, PrefObserver* observer); |
34 | 34 |
35 // We run the callback once, when initialization completes. The bool | 35 // We run the callback once, when initialization completes. The bool |
36 // parameter will be set to true for successful initialization, | 36 // parameter will be set to true for successful initialization, |
37 // false for unsuccessful. | 37 // false for unsuccessful. |
38 void AddInitObserver(base::Callback<void(bool)> observer); | 38 void AddInitObserver(base::Callback<void(bool)> observer); |
39 | 39 |
40 void SetPrefService(PrefService* pref_service); | 40 void SetPrefService(PrefService* pref_service); |
41 | 41 |
42 // PrefNotifier overrides. | |
engedy
2014/05/16 15:19:58
I might be missing something, but could we not jus
battre
2014/05/16 15:58:37
Done. I need to cast at the caller site now, but t
| |
43 // TODO(battre): Delete this. See crbug.com/373435. | |
44 virtual void SetPrefServiceDestructionTrace( | |
45 const std::string& stacktrace) OVERRIDE; | |
46 | |
42 protected: | 47 protected: |
43 // PrefNotifier overrides. | 48 // PrefNotifier overrides. |
44 virtual void OnPreferenceChanged(const std::string& pref_name) OVERRIDE; | 49 virtual void OnPreferenceChanged(const std::string& pref_name) OVERRIDE; |
45 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; | 50 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; |
46 | 51 |
47 // A map from pref names to a list of observers. Observers get fired in the | 52 // A map from pref names to a list of observers. Observers get fired in the |
48 // order they are added. These should only be accessed externally for unit | 53 // order they are added. These should only be accessed externally for unit |
49 // testing. | 54 // testing. |
50 typedef ObserverList<PrefObserver> PrefObserverList; | 55 typedef ObserverList<PrefObserver> PrefObserverList; |
51 typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap; | 56 typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap; |
(...skipping 12 matching lines...) Expand all Loading... | |
64 | 69 |
65 PrefObserverMap pref_observers_; | 70 PrefObserverMap pref_observers_; |
66 PrefInitObserverList init_observers_; | 71 PrefInitObserverList init_observers_; |
67 | 72 |
68 base::ThreadChecker thread_checker_; | 73 base::ThreadChecker thread_checker_; |
69 | 74 |
70 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); | 75 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); |
71 }; | 76 }; |
72 | 77 |
73 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_ | 78 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_ |
OLD | NEW |