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_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/observer_list.h"
12 #include "base/prefs/pref_store.h"
13 #include "chrome/browser/supervised_user/supervised_users.h"
16 class DictionaryValue
;
21 class SupervisedUserSettingsService
;
23 // A PrefStore that gets its values from supervised user settings via the
24 // SupervisedUserSettingsService passed in at construction.
25 class SupervisedUserPrefStore
: public PrefStore
{
27 SupervisedUserPrefStore(
28 SupervisedUserSettingsService
* supervised_user_settings_service
);
30 // PrefStore overrides:
31 bool GetValue(const std::string
& key
,
32 const base::Value
** value
) const override
;
33 void AddObserver(PrefStore::Observer
* observer
) override
;
34 void RemoveObserver(PrefStore::Observer
* observer
) override
;
35 bool HasObservers() const override
;
36 bool IsInitializationComplete() const override
;
39 ~SupervisedUserPrefStore() override
;
41 void OnNewSettingsAvailable(const base::DictionaryValue
* settings
);
43 scoped_ptr
<PrefValueMap
> prefs_
;
45 ObserverList
<PrefStore::Observer
, true> observers_
;
47 base::WeakPtrFactory
<SupervisedUserPrefStore
> weak_ptr_factory_
;
50 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_