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 CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ |
6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 13 matching lines...) Expand all Loading... |
24 class ConfigurationPolicyPrefKeeper; | 24 class ConfigurationPolicyPrefKeeper; |
25 | 25 |
26 // An implementation of PrefStore that bridges policy settings as read from a | 26 // An implementation of PrefStore that bridges policy settings as read from a |
27 // ConfigurationPolicyProvider to preferences. | 27 // ConfigurationPolicyProvider to preferences. |
28 class ConfigurationPolicyPrefStore | 28 class ConfigurationPolicyPrefStore |
29 : public PrefStore, | 29 : public PrefStore, |
30 public ConfigurationPolicyProvider::Observer { | 30 public ConfigurationPolicyProvider::Observer { |
31 public: | 31 public: |
32 // The ConfigurationPolicyPrefStore does not take ownership of the | 32 // The ConfigurationPolicyPrefStore does not take ownership of the |
33 // passed-in |provider|. | 33 // passed-in |provider|. |
34 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider); | 34 static ConfigurationPolicyPrefStore* Create( |
| 35 ConfigurationPolicyProvider* provider); |
35 virtual ~ConfigurationPolicyPrefStore(); | 36 virtual ~ConfigurationPolicyPrefStore(); |
36 | 37 |
37 // PrefStore methods: | 38 // PrefStore methods: |
38 virtual void AddObserver(PrefStore::Observer* observer); | 39 virtual void AddObserver(PrefStore::Observer* observer); |
39 virtual void RemoveObserver(PrefStore::Observer* observer); | 40 virtual void RemoveObserver(PrefStore::Observer* observer); |
40 virtual bool IsInitializationComplete() const; | 41 virtual bool IsInitializationComplete() const; |
41 virtual ReadResult GetValue(const std::string& key, | 42 virtual ReadResult GetValue(const std::string& key, |
42 const Value** result) const; | 43 const Value** result) const; |
43 | 44 |
44 // ConfigurationPolicyProvider::Observer methods: | 45 // ConfigurationPolicyProvider::Observer methods: |
(...skipping 14 matching lines...) Expand all Loading... |
59 | 60 |
60 // Creates a ConfigurationPolicyPrefStore that reads recommended cloud policy. | 61 // Creates a ConfigurationPolicyPrefStore that reads recommended cloud policy. |
61 static ConfigurationPolicyPrefStore* CreateRecommendedCloudPolicyPrefStore( | 62 static ConfigurationPolicyPrefStore* CreateRecommendedCloudPolicyPrefStore( |
62 Profile* profile); | 63 Profile* profile); |
63 | 64 |
64 // Returns the default policy definition list for Chrome. | 65 // Returns the default policy definition list for Chrome. |
65 static const ConfigurationPolicyProvider::PolicyDefinitionList* | 66 static const ConfigurationPolicyProvider::PolicyDefinitionList* |
66 GetChromePolicyDefinitionList(); | 67 GetChromePolicyDefinitionList(); |
67 | 68 |
68 private: | 69 private: |
| 70 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider); |
| 71 |
69 // Refreshes policy information, rereading policy from the provider and | 72 // Refreshes policy information, rereading policy from the provider and |
70 // sending out change notifications as appropriate. | 73 // sending out change notifications as appropriate. |
71 void Refresh(); | 74 void Refresh(); |
72 | 75 |
73 static const ConfigurationPolicyProvider::PolicyDefinitionList | 76 static const ConfigurationPolicyProvider::PolicyDefinitionList |
74 kPolicyDefinitionList; | 77 kPolicyDefinitionList; |
75 | 78 |
76 // The policy provider from which policy settings are read. | 79 // The policy provider from which policy settings are read. |
77 ConfigurationPolicyProvider* provider_; | 80 ConfigurationPolicyProvider* provider_; |
78 | 81 |
79 // Initialization status as reported by the policy provider the last time we | 82 // Initialization status as reported by the policy provider the last time we |
80 // queried it. | 83 // queried it. |
81 bool initialization_complete_; | 84 bool initialization_complete_; |
82 | 85 |
83 // Current policy preferences. | 86 // Current policy preferences. |
84 scoped_ptr<ConfigurationPolicyPrefKeeper> policy_keeper_; | 87 scoped_ptr<ConfigurationPolicyPrefKeeper> policy_keeper_; |
85 | 88 |
86 ObserverList<PrefStore::Observer, true> observers_; | 89 ObserverList<PrefStore::Observer, true> observers_; |
87 | 90 |
88 ConfigurationPolicyObserverRegistrar registrar_; | 91 ConfigurationPolicyObserverRegistrar registrar_; |
89 | 92 |
90 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); | 93 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); |
91 }; | 94 }; |
92 | 95 |
93 } // namespace policy | 96 } // namespace policy |
94 | 97 |
95 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ | 98 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ |
OLD | NEW |