1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/observer_list.h"
10 #include "base/prefs/pref_store.h"
11 #include "chrome/browser/supervised_user/supervised_users.h"
14 class DictionaryValue
;
19 class SupervisedUserSettingsService
;
21 // A PrefStore that gets its values from supervised user settings via the
22 // SupervisedUserSettingsService passed in at construction.
23 class SupervisedUserPrefStore
: public PrefStore
{
25 SupervisedUserPrefStore(
26 SupervisedUserSettingsService
* supervised_user_settings_service
);
28 // PrefStore overrides:
29 virtual bool GetValue(const std::string
& key
,
30 const base::Value
** value
) const OVERRIDE
;
31 virtual void AddObserver(PrefStore::Observer
* observer
) OVERRIDE
;
32 virtual void RemoveObserver(PrefStore::Observer
* observer
) OVERRIDE
;
33 virtual bool HasObservers() const OVERRIDE
;
34 virtual bool IsInitializationComplete() const OVERRIDE
;
37 virtual ~SupervisedUserPrefStore();
39 void OnNewSettingsAvailable(const base::DictionaryValue
* settings
);
41 scoped_ptr
<PrefValueMap
> prefs_
;
43 ObserverList
<PrefStore::Observer
, true> observers_
;
45 base::WeakPtrFactory
<SupervisedUserPrefStore
> weak_ptr_factory_
;
48 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_