| 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 |
| 11 #ifndef COMPONENTS_PREFS_PREF_SERVICE_H_ | 11 #ifndef COMPONENTS_PREFS_PREF_SERVICE_H_ |
| 12 #define COMPONENTS_PREFS_PREF_SERVICE_H_ | 12 #define COMPONENTS_PREFS_PREF_SERVICE_H_ |
| 13 | 13 |
| 14 #include <stdint.h> | 14 #include <stdint.h> |
| 15 | 15 |
| 16 #include <memory> | 16 #include <memory> |
| 17 #include <set> | 17 #include <set> |
| 18 #include <string> | 18 #include <string> |
| 19 | 19 |
| 20 #include "base/callback.h" | 20 #include "base/callback.h" |
| 21 #include "base/compiler_specific.h" | 21 #include "base/compiler_specific.h" |
| 22 #include "base/containers/hash_tables.h" | 22 #include "base/containers/hash_tables.h" |
| 23 #include "base/macros.h" | 23 #include "base/macros.h" |
| 24 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
| 25 #include "base/observer_list.h" | 25 #include "base/observer_list.h" |
| 26 #include "base/threading/non_thread_safe.h" | 26 #include "base/sequence_checker.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "components/prefs/base_prefs_export.h" | 28 #include "components/prefs/base_prefs_export.h" |
| 29 #include "components/prefs/persistent_pref_store.h" | 29 #include "components/prefs/persistent_pref_store.h" |
| 30 | 30 |
| 31 class PrefNotifier; | 31 class PrefNotifier; |
| 32 class PrefNotifierImpl; | 32 class PrefNotifierImpl; |
| 33 class PrefObserver; | 33 class PrefObserver; |
| 34 class PrefRegistry; | 34 class PrefRegistry; |
| 35 class PrefValueStore; | 35 class PrefValueStore; |
| 36 class PrefStore; | 36 class PrefStore; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 48 class ScopedUserPrefUpdateBase; | 48 class ScopedUserPrefUpdateBase; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Base class for PrefServices. You can use the base class to read and | 51 // Base class for PrefServices. You can use the base class to read and |
| 52 // interact with preferences, but not to register new preferences; for | 52 // interact with preferences, but not to register new preferences; for |
| 53 // that see e.g. PrefRegistrySimple. | 53 // that see e.g. PrefRegistrySimple. |
| 54 // | 54 // |
| 55 // Settings and storage accessed through this class represent | 55 // Settings and storage accessed through this class represent |
| 56 // user-selected preferences and information and MUST not be | 56 // user-selected preferences and information and MUST not be |
| 57 // extracted, overwritten or modified except through the defined APIs. | 57 // extracted, overwritten or modified except through the defined APIs. |
| 58 class COMPONENTS_PREFS_EXPORT PrefService : public base::NonThreadSafe { | 58 class COMPONENTS_PREFS_EXPORT PrefService { |
| 59 public: | 59 public: |
| 60 enum PrefInitializationStatus { | 60 enum PrefInitializationStatus { |
| 61 INITIALIZATION_STATUS_WAITING, | 61 INITIALIZATION_STATUS_WAITING, |
| 62 INITIALIZATION_STATUS_SUCCESS, | 62 INITIALIZATION_STATUS_SUCCESS, |
| 63 INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE, | 63 INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE, |
| 64 INITIALIZATION_STATUS_ERROR | 64 INITIALIZATION_STATUS_ERROR |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 enum IncludeDefaults { | 67 enum IncludeDefaults { |
| 68 INCLUDE_DEFAULTS, | 68 INCLUDE_DEFAULTS, |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // not need to find or create a Preference object to get the | 390 // not need to find or create a Preference object to get the |
| 391 // value (GetValue() calls back though the preference service to | 391 // value (GetValue() calls back though the preference service to |
| 392 // actually get the value.). | 392 // actually get the value.). |
| 393 const base::Value* GetPreferenceValue(const std::string& path) const; | 393 const base::Value* GetPreferenceValue(const std::string& path) const; |
| 394 | 394 |
| 395 // Local cache of registered Preference objects. The pref_registry_ | 395 // Local cache of registered Preference objects. The pref_registry_ |
| 396 // is authoritative with respect to what the types and default values | 396 // is authoritative with respect to what the types and default values |
| 397 // of registered preferences are. | 397 // of registered preferences are. |
| 398 mutable PreferenceMap prefs_map_; | 398 mutable PreferenceMap prefs_map_; |
| 399 | 399 |
| 400 SEQUENCE_CHECKER(sequence_checker_); |
| 401 |
| 400 DISALLOW_COPY_AND_ASSIGN(PrefService); | 402 DISALLOW_COPY_AND_ASSIGN(PrefService); |
| 401 }; | 403 }; |
| 402 | 404 |
| 403 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ | 405 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ |
| OLD | NEW |