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

Unified Diff: chrome/browser/pref_value_store.h

Issue 2823037: Add an ExtensionPrefStore, layered between the user prefs nad the managed pre... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/pref_service_unittest.cc ('k') | chrome/browser/pref_value_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/pref_value_store.h
===================================================================
--- chrome/browser/pref_value_store.h (revision 52073)
+++ chrome/browser/pref_value_store.h (working copy)
@@ -28,12 +28,13 @@
// (like an admin).
class PrefValueStore {
public:
- // |managed_prefs| contains all managed preference values. They have the
- // highest priority and precede user-defined preference values. |user_prefs|
- // contains all user-defined preference values. User-defined values precede
- // recommended values. |recommended_prefs| contains all recommended
- // preference values.
+ // In decreasing order of precedence:
+ // |managed_prefs| contains all managed (policy) preference values.
+ // |extension_prefs| contains preference values set by extensions.
+ // |user_prefs| contains all user-set preference values.
+ // |recommended_prefs| contains all recommended (policy) preference values.
PrefValueStore(PrefStore* managed_prefs,
+ PrefStore* extension_prefs,
PrefStore* user_prefs,
PrefStore* recommended_prefs);
@@ -44,14 +45,17 @@
bool GetValue(const std::wstring& name, Value** out_value) const;
// Read preference values into the three PrefStores so that they are available
- // through the GetValue method.
+ // through the GetValue method. Return the first error that occurs (but
+ // continue reading the remaining PrefStores).
PrefStore::PrefReadError ReadPrefs();
- // Write user settable preference values. Return true if writing values was
- // successfull.
+ // Persists prefs (to disk or elsewhere). Returns true if writing values was
+ // successful. In practice, only the user prefs are expected to be written
+ // out.
bool WritePrefs();
- // Calls the method ScheduleWritePrefs on the PrefStores.
+ // Calls the method ScheduleWritePrefs on the PrefStores. In practice, only
+ // the user prefs are expected to be written out.
void ScheduleWritePrefs();
// Returns true if the PrefValueStore contains the given preference.
@@ -68,7 +72,8 @@
// set. But GetValue calls will not return this value as long as the
// preference is managed. Instead GetValue will return the managed value
// of the preference. Note that the PrefValueStore takes the ownership of
- // the value referenced by |in_value|.
+ // the value referenced by |in_value|. It is an error to call this when no
+ // user PrefStore has been set.
void SetUserPrefValue(const wchar_t* name, Value* in_value);
// Removes a value from the PrefValueStore. If a preference is managed
@@ -81,10 +86,17 @@
bool PrefValueIsManaged(const wchar_t* name);
private:
- scoped_ptr<PrefStore> managed_prefs_;
- scoped_ptr<PrefStore> user_prefs_;
- scoped_ptr<PrefStore> recommended_prefs_;
+ // PrefStores must be listed here in order from highest to lowest priority.
+ enum PrefStoreType {
+ MANAGED = 0,
+ EXTENSION,
+ USER,
+ RECOMMENDED,
+ PREF_STORE_TYPE_MAX = RECOMMENDED
+ };
+ scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1];
+
DISALLOW_COPY_AND_ASSIGN(PrefValueStore);
};
Property changes on: chrome\browser\pref_value_store.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/pref_service_unittest.cc ('k') | chrome/browser/pref_value_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698