This source file includes following definitions.
- NON_EXPORTED_BASE
#ifndef BASE_PREFS_PREF_NOTIFIER_IMPL_H_
#define BASE_PREFS_PREF_NOTIFIER_IMPL_H_
#include <list>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/containers/hash_tables.h"
#include "base/observer_list.h"
#include "base/prefs/base_prefs_export.h"
#include "base/prefs/pref_notifier.h"
#include "base/prefs/pref_observer.h"
#include "base/threading/thread_checker.h"
class PrefService;
class BASE_PREFS_EXPORT PrefNotifierImpl
: public NON_EXPORTED_BASE(PrefNotifier) {
public:
PrefNotifierImpl();
explicit PrefNotifierImpl(PrefService* pref_service);
virtual ~PrefNotifierImpl();
void AddPrefObserver(const char* path, PrefObserver* observer);
void RemovePrefObserver(const char* path, PrefObserver* observer);
void AddInitObserver(base::Callback<void(bool)> observer);
void SetPrefService(PrefService* pref_service);
protected:
virtual void OnPreferenceChanged(const std::string& pref_name) OVERRIDE;
virtual void OnInitializationCompleted(bool succeeded) OVERRIDE;
typedef ObserverList<PrefObserver> PrefObserverList;
typedef base::hash_map<std::string, PrefObserverList*> PrefObserverMap;
typedef std::list<base::Callback<void(bool)> > PrefInitObserverList;
const PrefObserverMap* pref_observers() const { return &pref_observers_; }
private:
virtual void FireObservers(const std::string& path);
PrefService* pref_service_;
PrefObserverMap pref_observers_;
PrefInitObserverList init_observers_;
base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(PrefNotifierImpl);
};
#endif