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