OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This is the base interface for a preference services that provides | 5 // This is the base interface for a preference services that provides |
6 // a way to access the application's current preferences. | 6 // a way to access the application's current preferences. |
7 // | 7 // |
8 // This base interface assumes all preferences are local. See | 8 // This base interface assumes all preferences are local. See |
9 // SyncablePrefServiceBase for the interface to a preference service | 9 // SyncablePrefServiceBase for the interface to a preference service |
10 // that stores preferences that can be synced. | 10 // that stores preferences that can be synced. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 }; | 97 }; |
98 | 98 |
99 // Returns true if the preference for the given preference name is available | 99 // Returns true if the preference for the given preference name is available |
100 // and is managed. | 100 // and is managed. |
101 virtual bool IsManagedPreference(const char* pref_name) const = 0; | 101 virtual bool IsManagedPreference(const char* pref_name) const = 0; |
102 | 102 |
103 // Returns |true| if a preference with the given name is available and its | 103 // Returns |true| if a preference with the given name is available and its |
104 // value can be changed by the user. | 104 // value can be changed by the user. |
105 virtual bool IsUserModifiablePreference(const char* pref_name) const = 0; | 105 virtual bool IsUserModifiablePreference(const char* pref_name) const = 0; |
106 | 106 |
107 // Unregisters a preference. | |
108 virtual void UnregisterPreference(const char* path) = 0; | |
109 | |
110 // Look up a preference. Returns NULL if the preference is not | 107 // Look up a preference. Returns NULL if the preference is not |
111 // registered. | 108 // registered. |
112 virtual const Preference* FindPreference(const char* pref_name) const = 0; | 109 virtual const Preference* FindPreference(const char* pref_name) const = 0; |
113 | 110 |
114 // If the path is valid and the value at the end of the path matches the type | 111 // If the path is valid and the value at the end of the path matches the type |
115 // specified, it will return the specified value. Otherwise, the default | 112 // specified, it will return the specified value. Otherwise, the default |
116 // value (set when the pref was registered) will be returned. | 113 // value (set when the pref was registered) will be returned. |
117 virtual bool GetBoolean(const char* path) const = 0; | 114 virtual bool GetBoolean(const char* path) const = 0; |
118 virtual int GetInteger(const char* path) const = 0; | 115 virtual int GetInteger(const char* path) const = 0; |
119 virtual double GetDouble(const char* path) const = 0; | 116 virtual double GetDouble(const char* path) const = 0; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // | 164 // |
168 // If the pref at the given path changes, we call the observer's | 165 // If the pref at the given path changes, we call the observer's |
169 // OnPreferenceChanged method. Note that observers should not call | 166 // OnPreferenceChanged method. Note that observers should not call |
170 // these methods directly but rather use a PrefChangeRegistrar to | 167 // these methods directly but rather use a PrefChangeRegistrar to |
171 // make sure the observer gets cleaned up properly. | 168 // make sure the observer gets cleaned up properly. |
172 virtual void AddPrefObserver(const char* path, PrefObserver* obs) = 0; | 169 virtual void AddPrefObserver(const char* path, PrefObserver* obs) = 0; |
173 virtual void RemovePrefObserver(const char* path, PrefObserver* obs) = 0; | 170 virtual void RemovePrefObserver(const char* path, PrefObserver* obs) = 0; |
174 }; | 171 }; |
175 | 172 |
176 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ | 173 #endif // BASE_PREFS_PUBLIC_PREF_SERVICE_BASE_H_ |
OLD | NEW |