| 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 COMPONENTS_PREFS_PREF_NOTIFIER_IMPL_H_ |
| 6 #define BASE_PREFS_PREF_NOTIFIER_IMPL_H_ | 6 #define COMPONENTS_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/compiler_specific.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "components/prefs/base_prefs_export.h" | 17 #include "components/prefs/base_prefs_export.h" |
| 18 #include "components/prefs/pref_notifier.h" | 18 #include "components/prefs/pref_notifier.h" |
| 19 #include "components/prefs/pref_observer.h" | 19 #include "components/prefs/pref_observer.h" |
| 20 | 20 |
| 21 class PrefService; | 21 class PrefService; |
| 22 | 22 |
| 23 // The PrefNotifier implementation used by the PrefService. | 23 // The PrefNotifier implementation used by the PrefService. |
| 24 class BASE_PREFS_EXPORT PrefNotifierImpl | 24 class COMPONENTS_PREFS_EXPORT PrefNotifierImpl |
| 25 : public NON_EXPORTED_BASE(PrefNotifier) { | 25 : public NON_EXPORTED_BASE(PrefNotifier) { |
| 26 public: | 26 public: |
| 27 PrefNotifierImpl(); | 27 PrefNotifierImpl(); |
| 28 explicit PrefNotifierImpl(PrefService* pref_service); | 28 explicit PrefNotifierImpl(PrefService* pref_service); |
| 29 ~PrefNotifierImpl() override; | 29 ~PrefNotifierImpl() override; |
| 30 | 30 |
| 31 // 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 |
| 32 // OnPreferenceChanged method. | 32 // OnPreferenceChanged method. |
| 33 void AddPrefObserver(const std::string& path, PrefObserver* observer); | 33 void AddPrefObserver(const std::string& path, PrefObserver* observer); |
| 34 void RemovePrefObserver(const std::string& path, PrefObserver* observer); | 34 void RemovePrefObserver(const std::string& path, PrefObserver* observer); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 64 PrefService* pref_service_; | 64 PrefService* pref_service_; |
| 65 | 65 |
| 66 PrefObserverMap pref_observers_; | 66 PrefObserverMap pref_observers_; |
| 67 PrefInitObserverList init_observers_; | 67 PrefInitObserverList init_observers_; |
| 68 | 68 |
| 69 base::ThreadChecker thread_checker_; | 69 base::ThreadChecker thread_checker_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); | 71 DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 #endif // BASE_PREFS_PREF_NOTIFIER_IMPL_H_ | 74 #endif // COMPONENTS_PREFS_PREF_NOTIFIER_IMPL_H_ |
| OLD | NEW |