OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 static ConfigurationPolicyPrefStore* CreateDeviceManagementPolicyPrefStore( | 49 static ConfigurationPolicyPrefStore* CreateDeviceManagementPolicyPrefStore( |
50 Profile* profile); | 50 Profile* profile); |
51 | 51 |
52 // Creates a ConfigurationPolicyPrefStore that reads recommended policy. | 52 // Creates a ConfigurationPolicyPrefStore that reads recommended policy. |
53 static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore(); | 53 static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore(); |
54 | 54 |
55 // Returns the default policy definition list for Chrome. | 55 // Returns the default policy definition list for Chrome. |
56 static const ConfigurationPolicyProvider::PolicyDefinitionList* | 56 static const ConfigurationPolicyProvider::PolicyDefinitionList* |
57 GetChromePolicyDefinitionList(); | 57 GetChromePolicyDefinitionList(); |
58 | 58 |
59 // Returns the set of preference paths that can be affected by a proxy | |
60 // policy. | |
61 static void GetProxyPreferenceSet(ProxyPreferenceSet* proxy_pref_set); | |
62 | |
63 private: | 59 private: |
64 // Policies that map to a single preference are handled | 60 // Policies that map to a single preference are handled |
65 // by an automated converter. Each one of these policies | 61 // by an automated converter. Each one of these policies |
66 // has an entry in |simple_policy_map_| with the following type. | 62 // has an entry in |simple_policy_map_| with the following type. |
67 struct PolicyToPreferenceMapEntry { | 63 struct PolicyToPreferenceMapEntry { |
68 Value::ValueType value_type; | 64 Value::ValueType value_type; |
69 ConfigurationPolicyType policy_type; | 65 ConfigurationPolicyType policy_type; |
70 const char* preference_path; // A DictionaryValue path, not a file path. | 66 const char* preference_path; // A DictionaryValue path, not a file path. |
71 }; | 67 }; |
72 | 68 |
73 static const PolicyToPreferenceMapEntry kSimplePolicyMap[]; | 69 static const PolicyToPreferenceMapEntry kSimplePolicyMap[]; |
74 static const PolicyToPreferenceMapEntry kProxyPolicyMap[]; | 70 static const PolicyToPreferenceMapEntry kProxyPolicyMap[]; |
75 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[]; | 71 static const PolicyToPreferenceMapEntry kDefaultSearchPolicyMap[]; |
76 static const ConfigurationPolicyProvider::PolicyDefinitionList | 72 static const ConfigurationPolicyProvider::PolicyDefinitionList |
77 kPolicyDefinitionList; | 73 kPolicyDefinitionList; |
78 | 74 |
79 ConfigurationPolicyProvider* provider_; | 75 ConfigurationPolicyProvider* provider_; |
80 scoped_ptr<DictionaryValue> prefs_; | 76 scoped_ptr<DictionaryValue> prefs_; |
81 | 77 |
82 // Set to false until the first proxy-relevant policy is applied. At that | 78 // Set to false until the first proxy-relevant policy is applied. At that |
83 // time, default values are provided for all proxy-relevant prefs | 79 // time, default values are provided for all proxy-relevant prefs |
84 // to override any values set from stores with a lower priority. | 80 // to override any values set from stores with a lower priority. |
85 bool lower_priority_proxy_settings_overridden_; | 81 bool lower_priority_proxy_settings_overridden_; |
86 | 82 |
87 // The following are used to track what proxy-relevant policy has been applied | |
88 // accross calls to Apply to provide a warning if a policy specifies a | |
89 // contradictory proxy configuration. |proxy_disabled_| is set to true if and | |
90 // only if the kPolicyNoProxyServer has been applied, | |
91 // |proxy_configuration_specified_| is set to true if and only if any other | |
92 // proxy policy other than kPolicyNoProxyServer has been applied. | |
93 bool proxy_disabled_; | |
94 bool proxy_configuration_specified_; | |
95 | |
96 // Set to true if a the proxy mode policy has been set to force Chrome | |
97 // to use the system proxy. | |
98 bool use_system_proxy_; | |
99 | |
100 // Returns the map entry that corresponds to |policy| in the map. | 83 // Returns the map entry that corresponds to |policy| in the map. |
101 const PolicyToPreferenceMapEntry* FindPolicyInMap( | 84 const PolicyToPreferenceMapEntry* FindPolicyInMap( |
102 ConfigurationPolicyType policy, | 85 ConfigurationPolicyType policy, |
103 const PolicyToPreferenceMapEntry* map, | 86 const PolicyToPreferenceMapEntry* map, |
104 int size) const; | 87 int size) const; |
105 | 88 |
106 // Remove the preferences found in the map from |prefs_|. Returns true if | 89 // Remove the preferences found in the map from |prefs_|. Returns true if |
107 // any such preferences were found and removed. | 90 // any such preferences were found and removed. |
108 bool RemovePreferencesOfMap(const PolicyToPreferenceMapEntry* map, | 91 bool RemovePreferencesOfMap(const PolicyToPreferenceMapEntry* map, |
109 int table_size); | 92 int table_size); |
(...skipping 19 matching lines...) Expand all Loading... |
129 // Make sure that the |path| if present in |prefs_|. If not, set it to | 112 // Make sure that the |path| if present in |prefs_|. If not, set it to |
130 // a blank string. | 113 // a blank string. |
131 void EnsureStringPrefExists(const std::string& path); | 114 void EnsureStringPrefExists(const std::string& path); |
132 | 115 |
133 // If the required entries for default search are specified and valid, | 116 // If the required entries for default search are specified and valid, |
134 // finalizes the policy-specified configuration by initializing the | 117 // finalizes the policy-specified configuration by initializing the |
135 // unspecified map entries. Otherwise wipes all default search related | 118 // unspecified map entries. Otherwise wipes all default search related |
136 // map entries from |prefs_|. | 119 // map entries from |prefs_|. |
137 void FinalizeDefaultSearchPolicySettings(); | 120 void FinalizeDefaultSearchPolicySettings(); |
138 | 121 |
| 122 // Returns true if the preference at the given path exists and has a non-null |
| 123 // value. |
| 124 bool NonNullValueExists(const std::string& path); |
| 125 |
139 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); | 126 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyPrefStore); |
140 }; | 127 }; |
141 | 128 |
142 } // namespace policy | 129 } // namespace policy |
143 | 130 |
144 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ | 131 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PREF_STORE_H_ |
OLD | NEW |