Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: chrome/browser/prefs/pref_value_store.h

Issue 5174006: Move DeviceManagementPolicyProvider into the profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_PREFS_PREF_VALUE_STORE_H_ 5 #ifndef CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_
6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ 6 #define CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // |callback|. |callback| is called with the set of preferences changed by the 165 // |callback|. |callback| is called with the set of preferences changed by the
166 // policy refresh. |callback| is called on the caller's thread as a Task 166 // policy refresh. |callback| is called on the caller's thread as a Task
167 // after RefreshPolicyPrefs has returned. 167 // after RefreshPolicyPrefs has returned.
168 void RefreshPolicyPrefs(AfterRefreshCallback* callback); 168 void RefreshPolicyPrefs(AfterRefreshCallback* callback);
169 169
170 // Returns true if there are proxy preferences in user-modifiable 170 // Returns true if there are proxy preferences in user-modifiable
171 // preference stores (e.g. CommandLinePrefStore, ExtensionPrefStore) 171 // preference stores (e.g. CommandLinePrefStore, ExtensionPrefStore)
172 // that conflict with proxy settings specified by proxy policy. 172 // that conflict with proxy settings specified by proxy policy.
173 bool HasPolicyConflictingUserProxySettings(); 173 bool HasPolicyConflictingUserProxySettings();
174 174
175 protected: 175 protected:
176 // In decreasing order of precedence: 176 // In decreasing order of precedence:
177 // |managed_platform_prefs| contains all managed platform (non-cloud policy) 177 // |managed_platform_prefs| contains all managed platform (non-cloud policy)
178 // preference values. 178 // preference values.
179 // |device_management_prefs| contains all device management (cloud policy) 179 // |device_management_prefs| contains all device management (cloud policy)
180 // preference values. 180 // preference values.
181 // |extension_prefs| contains preference values set by extensions. 181 // |extension_prefs| contains preference values set by extensions.
182 // |command_line_prefs| contains preference values set by command-line 182 // |command_line_prefs| contains preference values set by command-line
183 // switches. 183 // switches.
184 // |user_prefs| contains all user-set preference values. 184 // |user_prefs| contains all user-set preference values.
185 // |recommended_prefs| contains all recommended (policy) preference values. 185 // |recommended_prefs| contains all recommended (policy) preference values.
186 // |default_prefs| contains application-default preference values. It must 186 // |default_prefs| contains application-default preference values. It must
187 // be non-null if any preferences are to be registered. 187 // be non-null if any preferences are to be registered.
Nico 2010/11/18 13:53:40 update comment?
Mattias Nissler (ping if slow) 2010/11/18 14:20:15 Done.
188 // 188 //
189 // This constructor should only be used internally, or by subclasses in 189 // This constructor should only be used internally, or by subclasses in
190 // testing. The usual way to create a PrefValueStore is by creating a 190 // testing. The usual way to create a PrefValueStore is by creating a
191 // PrefService. 191 // PrefService.
192 PrefValueStore(PrefStore* managed_platform_prefs, 192 PrefValueStore(PrefStore* managed_platform_prefs,
193 PrefStore* device_management_prefs, 193 PrefStore* device_management_prefs,
194 PrefStore* extension_prefs, 194 PrefStore* extension_prefs,
195 PrefStore* command_line_prefs, 195 PrefStore* command_line_prefs,
196 PrefStore* user_prefs, 196 PrefStore* user_prefs,
197 PrefStore* recommended_prefs, 197 PrefStore* recommended_prefs,
198 PrefStore* default_prefs); 198 PrefStore* default_prefs,
199 Profile* profile);
199 200
200 private: 201 private:
202 typedef std::map<std::string, Value::ValueType> PrefTypeMap;
203
201 friend class PrefValueStoreTest; 204 friend class PrefValueStoreTest;
202 FRIEND_TEST_ALL_PREFIXES(PrefValueStoreTest, 205 FRIEND_TEST_ALL_PREFIXES(PrefValueStoreTest,
203 TestRefreshPolicyPrefsCompletion); 206 TestRefreshPolicyPrefsCompletion);
204 207
205 scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1];
206
207 // A mapping of preference names to their registered types.
208 typedef std::map<std::string, Value::ValueType> PrefTypeMap;
209 PrefTypeMap pref_types_;
210
211 // Returns true if the preference with the given name has a value in the 208 // Returns true if the preference with the given name has a value in the
212 // given PrefStoreType, of the same value type as the preference was 209 // given PrefStoreType, of the same value type as the preference was
213 // registered with. 210 // registered with.
214 bool PrefValueInStore(const char* name, 211 bool PrefValueInStore(const char* name,
215 PrefNotifier::PrefStoreType store) const; 212 PrefNotifier::PrefStoreType store) const;
216 213
217 // Get a value from the specified store type. 214 // Get a value from the specified store type.
218 bool GetValueFromStore(const char* name, 215 bool GetValueFromStore(const char* name,
219 PrefNotifier::PrefStoreType store, 216 PrefNotifier::PrefStoreType store,
220 Value** out_value) const; 217 Value** out_value) const;
221 218
222 // Called during policy refresh after ReadPrefs completes on the thread 219 // Called during policy refresh after ReadPrefs completes on the thread
223 // that initiated the policy refresh. RefreshPolicyPrefsCompletion takes 220 // that initiated the policy refresh. RefreshPolicyPrefsCompletion takes
224 // ownership of the |callback| object. 221 // ownership of the |callback| object.
225 void RefreshPolicyPrefsCompletion( 222 void RefreshPolicyPrefsCompletion(
226 PrefStore* new_managed_platform_pref_store, 223 PrefStore* new_managed_platform_pref_store,
227 PrefStore* new_device_management_pref_store, 224 PrefStore* new_device_management_pref_store,
228 PrefStore* new_recommended_pref_store, 225 PrefStore* new_recommended_pref_store,
229 AfterRefreshCallback* callback); 226 AfterRefreshCallback* callback);
230 227
231 // Called during policy refresh to do the ReadPrefs on the FILE thread. 228 // Called during policy refresh to do the ReadPrefs on the FILE thread.
232 // RefreshPolicyPrefsOnFileThread takes ownership of the |callback| object. 229 // RefreshPolicyPrefsOnFileThread takes ownership of the |callback| object.
233 void RefreshPolicyPrefsOnFileThread( 230 void RefreshPolicyPrefsOnFileThread(
234 BrowserThread::ID calling_thread_id, 231 BrowserThread::ID calling_thread_id,
235 PrefStore* new_managed_platform_pref_store, 232 PrefStore* new_managed_platform_pref_store,
236 PrefStore* new_device_management_pref_store, 233 PrefStore* new_device_management_pref_store,
237 PrefStore* new_recommended_pref_store, 234 PrefStore* new_recommended_pref_store,
238 AfterRefreshCallback* callback); 235 AfterRefreshCallback* callback);
239 236
237 scoped_ptr<PrefStore> pref_stores_[PrefNotifier::PREF_STORE_TYPE_MAX + 1];
238
239 // A mapping of preference names to their registered types.
240 PrefTypeMap pref_types_;
241
242 // The associated profile, if applicable.
243 Profile* profile_;
244
240 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); 245 DISALLOW_COPY_AND_ASSIGN(PrefValueStore);
241 }; 246 };
242 247
243 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_ 248 #endif // CHROME_BROWSER_PREFS_PREF_VALUE_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698