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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "chrome/browser/policy/configuration_policy_provider.h" | 16 #include "chrome/browser/policy/configuration_policy_provider.h" |
17 #include "chrome/browser/policy/configuration_policy_store_interface.h" | 17 #include "chrome/browser/policy/configuration_policy_store_interface.h" |
18 #include "chrome/common/pref_store.h" | 18 #include "chrome/common/pref_store.h" |
19 | 19 |
20 class Profile; | |
21 | |
22 namespace policy { | 20 namespace policy { |
23 | 21 |
24 class ConfigurationPolicyPrefKeeper; | 22 class ConfigurationPolicyPrefKeeper; |
25 | 23 |
26 // An implementation of PrefStore that bridges policy settings as read from a | 24 // An implementation of PrefStore that bridges policy settings as read from a |
27 // ConfigurationPolicyProvider to preferences. | 25 // ConfigurationPolicyProvider to preferences. |
28 class ConfigurationPolicyPrefStore | 26 class ConfigurationPolicyPrefStore |
29 : public PrefStore, | 27 : public PrefStore, |
30 public ConfigurationPolicyProvider::Observer { | 28 public ConfigurationPolicyProvider::Observer { |
31 public: | 29 public: |
(...skipping 11 matching lines...) Expand all Loading... |
43 const Value** result) const; | 41 const Value** result) const; |
44 | 42 |
45 // ConfigurationPolicyProvider::Observer methods: | 43 // ConfigurationPolicyProvider::Observer methods: |
46 virtual void OnUpdatePolicy(); | 44 virtual void OnUpdatePolicy(); |
47 virtual void OnProviderGoingAway(); | 45 virtual void OnProviderGoingAway(); |
48 | 46 |
49 // Creates a ConfigurationPolicyPrefStore that reads managed platform policy. | 47 // Creates a ConfigurationPolicyPrefStore that reads managed platform policy. |
50 static ConfigurationPolicyPrefStore* CreateManagedPlatformPolicyPrefStore(); | 48 static ConfigurationPolicyPrefStore* CreateManagedPlatformPolicyPrefStore(); |
51 | 49 |
52 // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. | 50 // Creates a ConfigurationPolicyPrefStore that reads managed cloud policy. |
53 static ConfigurationPolicyPrefStore* CreateManagedCloudPolicyPrefStore( | 51 static ConfigurationPolicyPrefStore* CreateManagedCloudPolicyPrefStore(); |
54 Profile* profile); | |
55 | 52 |
56 // Creates a ConfigurationPolicyPrefStore that reads recommended platform | 53 // Creates a ConfigurationPolicyPrefStore that reads recommended platform |
57 // policy. | 54 // policy. |
58 static ConfigurationPolicyPrefStore* | 55 static ConfigurationPolicyPrefStore* |
59 CreateRecommendedPlatformPolicyPrefStore(); | 56 CreateRecommendedPlatformPolicyPrefStore(); |
60 | 57 |
61 // Creates a ConfigurationPolicyPrefStore that reads recommended cloud policy. | 58 // Creates a ConfigurationPolicyPrefStore that reads recommended cloud policy. |
62 static ConfigurationPolicyPrefStore* CreateRecommendedCloudPolicyPrefStore( | 59 static ConfigurationPolicyPrefStore* CreateRecommendedCloudPolicyPrefStore(); |
63 Profile* profile); | |
64 | 60 |
65 // Returns the default policy definition list for Chrome. | 61 // Returns the default policy definition list for Chrome. |
66 static const ConfigurationPolicyProvider::PolicyDefinitionList* | 62 static const ConfigurationPolicyProvider::PolicyDefinitionList* |
67 GetChromePolicyDefinitionList(); | 63 GetChromePolicyDefinitionList(); |
68 | 64 |
69 private: | 65 private: |
70 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider); | 66 explicit ConfigurationPolicyPrefStore(ConfigurationPolicyProvider* provider); |
71 | 67 |
72 // Refreshes policy information, rereading policy from the provider and | 68 // Refreshes policy information, rereading policy from the provider and |
73 // sending out change notifications as appropriate. | 69 // sending out change notifications as appropriate. |
(...skipping 15 matching lines...) Expand all Loading... |
89 ObserverList<PrefStore::Observer, true> observers_; | 85 ObserverList<PrefStore::Observer, true> observers_; |
90 | 86 |
91 ConfigurationPolicyObserverRegistrar registrar_; | 87 ConfigurationPolicyObserverRegistrar registrar_; |
92 | 88 |
93 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); | 89 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); |
94 }; | 90 }; |
95 | 91 |
96 } // namespace policy | 92 } // namespace policy |
97 | 93 |
98 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ | 94 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ |
OLD | NEW |