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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // preference is managed. Instead GetValue will return the managed value | 73 // preference is managed. Instead GetValue will return the managed value |
74 // of the preference. Note that the PrefValueStore takes the ownership of | 74 // of the preference. Note that the PrefValueStore takes the ownership of |
75 // the value referenced by |in_value|. It is an error to call this when no | 75 // the value referenced by |in_value|. It is an error to call this when no |
76 // user PrefStore has been set. | 76 // user PrefStore has been set. |
77 void SetUserPrefValue(const wchar_t* name, Value* in_value); | 77 void SetUserPrefValue(const wchar_t* name, Value* in_value); |
78 | 78 |
79 // Removes a value from the PrefValueStore. If a preference is managed | 79 // Removes a value from the PrefValueStore. If a preference is managed |
80 // or recommended this function should have no effect. | 80 // or recommended this function should have no effect. |
81 void RemoveUserPrefValue(const wchar_t* name); | 81 void RemoveUserPrefValue(const wchar_t* name); |
82 | 82 |
83 // Returns true if the preference with the given name is managed. | 83 // These methods return true if a preference with the given name is in the |
84 // A preference is managed if a managed value is available for that | 84 // indicated pref store, even if that value is currently being overridden by |
85 // preference. | 85 // a higher-priority source. |
86 bool PrefValueIsManaged(const wchar_t* name); | 86 bool PrefValueInManagedStore(const wchar_t* name); |
| 87 bool PrefValueInExtensionStore(const wchar_t* name); |
| 88 bool PrefValueInUserStore(const wchar_t* name); |
| 89 |
| 90 // These methods return true if a preference with the given name is actually |
| 91 // being controlled by the indicated pref store and not being overridden by |
| 92 // a higher-priority source. |
| 93 bool PrefValueFromExtensionStore(const wchar_t* name); |
| 94 bool PrefValueFromUserStore(const wchar_t* name); |
87 | 95 |
88 private: | 96 private: |
89 // PrefStores must be listed here in order from highest to lowest priority. | 97 // PrefStores must be listed here in order from highest to lowest priority. |
90 enum PrefStoreType { | 98 enum PrefStoreType { |
91 MANAGED = 0, | 99 MANAGED = 0, |
92 EXTENSION, | 100 EXTENSION, |
93 USER, | 101 USER, |
94 RECOMMENDED, | 102 RECOMMENDED, |
95 PREF_STORE_TYPE_MAX = RECOMMENDED | 103 PREF_STORE_TYPE_MAX = RECOMMENDED |
96 }; | 104 }; |
97 | 105 |
98 scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1]; | 106 scoped_ptr<PrefStore> pref_stores_[PREF_STORE_TYPE_MAX + 1]; |
99 | 107 |
| 108 bool PrefValueInStore(const wchar_t* name, PrefStoreType type); |
| 109 |
| 110 bool PrefValueFromStore(const wchar_t* name, PrefStoreType type); |
| 111 |
100 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); | 112 DISALLOW_COPY_AND_ASSIGN(PrefValueStore); |
101 }; | 113 }; |
102 | 114 |
103 #endif // CHROME_BROWSER_PREF_VALUE_STORE_H_ | 115 #endif // CHROME_BROWSER_PREF_VALUE_STORE_H_ |
OLD | NEW |