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 CHROME_BROWSER_PREFS_PREF_NOTIFIER_IMPL_H_ | 5 #ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_ |
6 #define CHROME_BROWSER_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 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" |
12 #include "base/hash_tables.h" | 13 #include "base/hash_tables.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/prefs/base_prefs_export.h" |
14 #include "base/prefs/pref_notifier.h" | 16 #include "base/prefs/pref_notifier.h" |
15 #include "base/prefs/pref_observer.h" | 17 #include "base/prefs/pref_observer.h" |
16 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
17 | 19 |
18 class PrefService; | 20 class PrefService; |
19 | 21 |
20 // The PrefNotifier implementation used by the PrefService. | 22 // The PrefNotifier implementation used by the PrefService. |
21 class PrefNotifierImpl : public PrefNotifier, | 23 class BASE_PREFS_EXPORT PrefNotifierImpl |
22 public base::NonThreadSafe { | 24 : public NON_EXPORTED_BASE(PrefNotifier), |
| 25 public base::NonThreadSafe { |
23 public: | 26 public: |
24 PrefNotifierImpl(); | 27 PrefNotifierImpl(); |
25 explicit PrefNotifierImpl(PrefService* pref_service); | 28 explicit PrefNotifierImpl(PrefService* pref_service); |
26 virtual ~PrefNotifierImpl(); | 29 virtual ~PrefNotifierImpl(); |
27 | 30 |
28 // If the pref at the given path changes, we call the observer's | 31 // If the pref at the given path changes, we call the observer's |
29 // OnPreferenceChanged method. | 32 // OnPreferenceChanged method. |
30 void AddPrefObserver(const char* path, PrefObserver* observer); | 33 void AddPrefObserver(const char* path, PrefObserver* observer); |
31 void RemovePrefObserver(const char* path, PrefObserver* observer); | 34 void RemovePrefObserver(const char* path, PrefObserver* observer); |
32 | 35 |
(...skipping 26 matching lines...) Expand all Loading... |
59 | 62 |
60 // Weak reference; the notifier is owned by the PrefService. | 63 // Weak reference; the notifier is owned by the PrefService. |
61 PrefService* pref_service_; | 64 PrefService* pref_service_; |
62 | 65 |
63 PrefObserverMap pref_observers_; | 66 PrefObserverMap pref_observers_; |
64 PrefInitObserverList init_observers_; | 67 PrefInitObserverList init_observers_; |
65 | 68 |
66 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); | 69 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); |
67 }; | 70 }; |
68 | 71 |
69 #endif // CHROME_BROWSER_PREFS_PREF_NOTIFIER_IMPL_H_ | 72 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_ |
OLD | NEW |