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 CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 11 #ifndef BASE_PREFS_PREF_SERVICE_H_ |
12 #define CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 12 #define BASE_PREFS_PREF_SERVICE_H_ |
13 | 13 |
14 #include <set> | 14 #include <set> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/callback.h" | 17 #include "base/callback.h" |
18 #include "base/hash_tables.h" | 18 #include "base/hash_tables.h" |
19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
21 #include "base/observer_list.h" | 21 #include "base/observer_list.h" |
| 22 #include "base/prefs/base_prefs_export.h" |
22 #include "base/prefs/persistent_pref_store.h" | 23 #include "base/prefs/persistent_pref_store.h" |
23 #include "base/prefs/public/pref_service_base.h" | 24 #include "base/prefs/public/pref_service_base.h" |
24 #include "base/threading/non_thread_safe.h" | 25 #include "base/threading/non_thread_safe.h" |
25 | 26 |
26 class PrefNotifier; | 27 class PrefNotifier; |
27 class PrefNotifierImpl; | 28 class PrefNotifierImpl; |
28 class PrefObserver; | 29 class PrefObserver; |
29 class PrefRegistry; | 30 class PrefRegistry; |
30 class PrefValueStore; | 31 class PrefValueStore; |
31 class PrefStore; | 32 class PrefStore; |
32 | 33 |
33 namespace subtle { | 34 namespace subtle { |
34 class ScopedUserPrefUpdateBase; | 35 class ScopedUserPrefUpdateBase; |
35 }; | 36 }; |
36 | 37 |
37 // Base class for PrefServices. You can use the base class to read and | 38 // Base class for PrefServices. You can use the base class to read and |
38 // interact with preferences, but not to register new preferences; for | 39 // interact with preferences, but not to register new preferences; for |
39 // that see e.g. PrefRegistrySimple. | 40 // that see e.g. PrefRegistrySimple. |
40 class PrefService : public PrefServiceBase, public base::NonThreadSafe { | 41 class BASE_PREFS_EXPORT PrefService : public PrefServiceBase, |
| 42 public base::NonThreadSafe { |
41 public: | 43 public: |
42 enum PrefInitializationStatus { | 44 enum PrefInitializationStatus { |
43 INITIALIZATION_STATUS_WAITING, | 45 INITIALIZATION_STATUS_WAITING, |
44 INITIALIZATION_STATUS_SUCCESS, | 46 INITIALIZATION_STATUS_SUCCESS, |
45 INITIALIZATION_STATUS_CREATED_NEW_PROFILE, | 47 INITIALIZATION_STATUS_CREATED_NEW_PROFILE, |
46 INITIALIZATION_STATUS_ERROR | 48 INITIALIZATION_STATUS_ERROR |
47 }; | 49 }; |
48 | 50 |
49 // A helper class to store all the information associated with a preference. | 51 // A helper class to store all the information associated with a preference. |
50 class Preference : public PrefServiceBase::Preference { | 52 class Preference : public PrefServiceBase::Preference { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 const base::Value* GetPreferenceValue(const std::string& path) const; | 251 const base::Value* GetPreferenceValue(const std::string& path) const; |
250 | 252 |
251 // Local cache of registered Preference objects. The pref_registry_ | 253 // Local cache of registered Preference objects. The pref_registry_ |
252 // is authoritative with respect to what the types and default values | 254 // is authoritative with respect to what the types and default values |
253 // of registered preferences are. | 255 // of registered preferences are. |
254 mutable PreferenceMap prefs_map_; | 256 mutable PreferenceMap prefs_map_; |
255 | 257 |
256 DISALLOW_COPY_AND_ASSIGN(PrefService); | 258 DISALLOW_COPY_AND_ASSIGN(PrefService); |
257 }; | 259 }; |
258 | 260 |
259 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ | 261 #endif // BASE_PREFS_PREF_SERVICE_H_ |
OLD | NEW |