Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / supervised_user / supervised_user_pref_store.h
blob42b4a135b03b4aaabc48289fcaa1bf8d638e201a
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 <string>
10 #include "base/callback_list.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h"
13 #include "base/prefs/pref_store.h"
14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/supervised_user/supervised_users.h"
16 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h"
19 namespace base {
20 class DictionaryValue;
21 class Value;
24 class PrefValueMap;
25 class SupervisedUserSettingsService;
27 // A PrefStore that gets its values from supervised user settings via the
28 // SupervisedUserSettingsService passed in at construction.
29 class SupervisedUserPrefStore : public PrefStore,
30 public content::NotificationObserver {
31 public:
32 SupervisedUserPrefStore(
33 SupervisedUserSettingsService* supervised_user_settings_service);
35 // PrefStore overrides:
36 bool GetValue(const std::string& key,
37 const base::Value** value) const override;
38 void AddObserver(PrefStore::Observer* observer) override;
39 void RemoveObserver(PrefStore::Observer* observer) override;
40 bool HasObservers() const override;
41 bool IsInitializationComplete() const override;
43 // NotificationObserver implementation.
44 void Observe(int type,
45 const content::NotificationSource& src,
46 const content::NotificationDetails& details) override;
48 private:
49 ~SupervisedUserPrefStore() override;
51 void OnNewSettingsAvailable(const base::DictionaryValue* settings);
53 scoped_ptr<base::CallbackList<void(
54 const base::DictionaryValue*)>::Subscription> user_settings_subscription_;
55 content::NotificationRegistrar unsubscriber_registrar_;
57 scoped_ptr<PrefValueMap> prefs_;
59 base::ObserverList<PrefStore::Observer, true> observers_;
62 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_PREF_STORE_H_