| 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 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 // Chromium settings and storage represent user-selected preferences and | 7 // Chromium settings and storage represent user-selected preferences and |
| 8 // information and MUST not be extracted, overwritten or modified except | 8 // information and MUST not be extracted, overwritten or modified except |
| 9 // through Chromium defined APIs. | 9 // through Chromium defined APIs. |
| 10 | 10 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 // Virtual for testing. | 348 // Virtual for testing. |
| 349 virtual void AddPrefObserver(const std::string& path, PrefObserver* obs); | 349 virtual void AddPrefObserver(const std::string& path, PrefObserver* obs); |
| 350 virtual void RemovePrefObserver(const std::string& path, PrefObserver* obs); | 350 virtual void RemovePrefObserver(const std::string& path, PrefObserver* obs); |
| 351 | 351 |
| 352 // Sends notification of a changed preference. This needs to be called by | 352 // Sends notification of a changed preference. This needs to be called by |
| 353 // a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed. | 353 // a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed. |
| 354 void ReportUserPrefChanged(const std::string& key); | 354 void ReportUserPrefChanged(const std::string& key); |
| 355 | 355 |
| 356 // Sets the value for this pref path in the user pref store and informs the | 356 // Sets the value for this pref path in the user pref store and informs the |
| 357 // PrefNotifier of the change. | 357 // PrefNotifier of the change. |
| 358 void SetUserPrefValue(const std::string& path, base::Value* new_value); | 358 void SetUserPrefValue(const std::string& path, |
| 359 std::unique_ptr<base::Value> new_value); |
| 359 | 360 |
| 360 // Load preferences from storage, attempting to diagnose and handle errors. | 361 // Load preferences from storage, attempting to diagnose and handle errors. |
| 361 // This should only be called from the constructor. | 362 // This should only be called from the constructor. |
| 362 void InitFromStorage(bool async); | 363 void InitFromStorage(bool async); |
| 363 | 364 |
| 364 // Used to set the value of dictionary or list values in the user pref store. | 365 // Used to set the value of dictionary or list values in the user pref store. |
| 365 // This will create a dictionary or list if one does not exist in the user | 366 // This will create a dictionary or list if one does not exist in the user |
| 366 // pref store. This method returns NULL only if you're requesting an | 367 // pref store. This method returns NULL only if you're requesting an |
| 367 // unregistered pref or a non-dict/non-list pref. | 368 // unregistered pref or a non-dict/non-list pref. |
| 368 // |type| may only be Values::Type::DICTIONARY or Values::Type::LIST and | 369 // |type| may only be Values::Type::DICTIONARY or Values::Type::LIST and |
| (...skipping 11 matching lines...) Expand all Loading... |
| 380 | 381 |
| 381 // Local cache of registered Preference objects. The pref_registry_ | 382 // Local cache of registered Preference objects. The pref_registry_ |
| 382 // is authoritative with respect to what the types and default values | 383 // is authoritative with respect to what the types and default values |
| 383 // of registered preferences are. | 384 // of registered preferences are. |
| 384 mutable PreferenceMap prefs_map_; | 385 mutable PreferenceMap prefs_map_; |
| 385 | 386 |
| 386 DISALLOW_COPY_AND_ASSIGN(PrefService); | 387 DISALLOW_COPY_AND_ASSIGN(PrefService); |
| 387 }; | 388 }; |
| 388 | 389 |
| 389 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ | 390 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ |
| OLD | NEW |