| 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_PREF_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_PREF_VALUE_STORE_H_ |
| 6 #define CHROME_BROWSER_PREF_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_PREF_VALUE_STORE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 bool PrefValueInManagedStore(const wchar_t* name); | 89 bool PrefValueInManagedStore(const wchar_t* name); |
| 90 bool PrefValueInExtensionStore(const wchar_t* name); | 90 bool PrefValueInExtensionStore(const wchar_t* name); |
| 91 bool PrefValueInUserStore(const wchar_t* name); | 91 bool PrefValueInUserStore(const wchar_t* name); |
| 92 | 92 |
| 93 // These methods return true if a preference with the given name is actually | 93 // These methods return true if a preference with the given name is actually |
| 94 // being controlled by the indicated pref store and not being overridden by | 94 // being controlled by the indicated pref store and not being overridden by |
| 95 // a higher-priority source. | 95 // a higher-priority source. |
| 96 bool PrefValueFromExtensionStore(const wchar_t* name); | 96 bool PrefValueFromExtensionStore(const wchar_t* name); |
| 97 bool PrefValueFromUserStore(const wchar_t* name); | 97 bool PrefValueFromUserStore(const wchar_t* name); |
| 98 | 98 |
| 99 // Check whether a Preference value is modifiable by the user, i.e. whether |
| 100 // there is no higher-priority source controlling it. |
| 101 bool PrefValueUserModifiable(const wchar_t* name); |
| 102 |
| 99 private: | 103 private: |
| 100 // PrefStores must be listed here in order from highest to lowest priority. | 104 // PrefStores must be listed here in order from highest to lowest priority. |
| 101 enum PrefStoreType { | 105 enum PrefStoreType { |
| 106 // Not associated with an actual PrefStore but used as invalid marker, e.g. |
| 107 // as return value. |
| 108 INVALID = -1, |
| 102 MANAGED = 0, | 109 MANAGED = 0, |
| 103 EXTENSION, | 110 EXTENSION, |
| 104 COMMAND_LINE, | 111 COMMAND_LINE, |
| 105 USER, | 112 USER, |
| 106 RECOMMENDED, | 113 RECOMMENDED, |
| 107 PREF_STORE_TYPE_MAX = RECOMMENDED | 114 PREF_STORE_TYPE_MAX = RECOMMENDED |
| 108 }; | 115 }; |
| 109 | 116 |
| 110 scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1]; | 117 scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1]; |
| 111 | 118 |
| 112 bool PrefValueInStore(const wchar_t* name, PrefStoreType type); | 119 bool PrefValueInStore(const wchar_t* name, PrefStoreType type); |
| 113 | 120 |
| 114 bool PrefValueFromStore(const wchar_t* name, PrefStoreType type); | 121 // Returns the pref store type identifying the source that controls the |
| 122 // Preference identified by |name|. If none of the sources has a value, |
| 123 // INVALID is returned. |
| 124 PrefStoreType ControllingPrefStoreForPref(const wchar_t* name); |
| 115 | 125 |
| 116 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 126 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
| 117 }; | 127 }; |
| 118 | 128 |
| 119 #endif // CHROME_BROWSER_PREF_VALUE_STORE_H_ | 129 #endif // CHROME_BROWSER_PREF_VALUE_STORE_H_ |
| OLD | NEW |