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 // This provides a way to access the application's current preferences. | 5 // This provides a way to access the application's current preferences. |
6 | 6 |
7 #ifndef CHROME_BROWSER_PREF_SERVICE_H_ | 7 #ifndef CHROME_BROWSER_PREF_SERVICE_H_ |
8 #define CHROME_BROWSER_PREF_SERVICE_H_ | 8 #define CHROME_BROWSER_PREF_SERVICE_H_ |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // browser.window_placement). | 45 // browser.window_placement). |
46 const std::wstring name() const { return name_; } | 46 const std::wstring name() const { return name_; } |
47 | 47 |
48 // Returns the value of the Preference. If there is no user specified | 48 // Returns the value of the Preference. If there is no user specified |
49 // value, it returns the default value. | 49 // value, it returns the default value. |
50 const Value* GetValue() const; | 50 const Value* GetValue() const; |
51 | 51 |
52 // Returns true if the current value matches the default value. | 52 // Returns true if the current value matches the default value. |
53 bool IsDefaultValue() const; | 53 bool IsDefaultValue() const; |
54 | 54 |
55 // Returns true if the Preference is managed, i.e. not changeable | 55 // Returns true if the Preference is managed, i.e. set by an admin policy. |
56 // by the user. | 56 // Since managed prefs have the highest priority, this also indicates |
| 57 // whether the pref is actually being controlled by the policy setting. |
57 bool IsManaged() const; | 58 bool IsManaged() const; |
58 | 59 |
| 60 // Returns true if the Preference has a value set by an extension, even if |
| 61 // that value is being overridden by a higher-priority source. |
| 62 bool HasExtensionSetting() const; |
| 63 |
| 64 // Returns true if the Preference has a user setting, even if that value is |
| 65 // being overridden by a higher-priority source. |
| 66 bool HasUserSetting() const; |
| 67 |
| 68 // Returns true if the Preference value is currently being controlled by an |
| 69 // extension, and not by any higher-priority source. |
| 70 bool IsExtensionControlled() const; |
| 71 |
| 72 // Returns true if the Preference value is currently being controlled by a |
| 73 // user setting, and not by any higher-priority source. |
| 74 bool IsUserControlled() const; |
| 75 |
59 private: | 76 private: |
60 friend class PrefService; | 77 friend class PrefService; |
61 | 78 |
62 Value::ValueType type_; | 79 Value::ValueType type_; |
63 std::wstring name_; | 80 std::wstring name_; |
64 scoped_ptr<Value> default_value_; | 81 scoped_ptr<Value> default_value_; |
65 | 82 |
66 // A reference to the pref service's pref_value_store_. | 83 // A reference to the pref service's pref_value_store_. |
67 PrefValueStore* pref_value_store_; | 84 PrefValueStore* pref_value_store_; |
68 | 85 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 typedef base::hash_map<std::wstring, NotificationObserverList*> | 256 typedef base::hash_map<std::wstring, NotificationObserverList*> |
240 PrefObserverMap; | 257 PrefObserverMap; |
241 PrefObserverMap pref_observers_; | 258 PrefObserverMap pref_observers_; |
242 | 259 |
243 friend class ScopedPrefUpdate; | 260 friend class ScopedPrefUpdate; |
244 | 261 |
245 DISALLOW_COPY_AND_ASSIGN(PrefService); | 262 DISALLOW_COPY_AND_ASSIGN(PrefService); |
246 }; | 263 }; |
247 | 264 |
248 #endif // CHROME_BROWSER_PREF_SERVICE_H_ | 265 #endif // CHROME_BROWSER_PREF_SERVICE_H_ |
OLD | NEW |