Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: components/prefs/pref_service.h

Issue 1662843002: Revert of Delete base/prefs and update callers to use components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/prefs/pref_registry_simple.h ('k') | components/prefs/pref_service_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 BASE_PREFS_PREF_SERVICE_H_
12 #define COMPONENTS_PREFS_PREF_SERVICE_H_ 12 #define BASE_PREFS_PREF_SERVICE_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include <set> 16 #include <set>
17 #include <string> 17 #include <string>
18 18
19 #include "base/callback.h" 19 #include "base/callback.h"
20 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
21 #include "base/containers/hash_tables.h" 21 #include "base/containers/hash_tables.h"
22 #include "base/macros.h" 22 #include "base/macros.h"
(...skipping 21 matching lines...) Expand all
44 class ScopedUserPrefUpdateBase; 44 class ScopedUserPrefUpdateBase;
45 } 45 }
46 46
47 // Base class for PrefServices. You can use the base class to read and 47 // Base class for PrefServices. You can use the base class to read and
48 // interact with preferences, but not to register new preferences; for 48 // interact with preferences, but not to register new preferences; for
49 // that see e.g. PrefRegistrySimple. 49 // that see e.g. PrefRegistrySimple.
50 // 50 //
51 // Settings and storage accessed through this class represent 51 // Settings and storage accessed through this class represent
52 // user-selected preferences and information and MUST not be 52 // user-selected preferences and information and MUST not be
53 // extracted, overwritten or modified except through the defined APIs. 53 // extracted, overwritten or modified except through the defined APIs.
54 class COMPONENTS_PREFS_EXPORT PrefService : public base::NonThreadSafe { 54 class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe {
55 public: 55 public:
56 enum PrefInitializationStatus { 56 enum PrefInitializationStatus {
57 INITIALIZATION_STATUS_WAITING, 57 INITIALIZATION_STATUS_WAITING,
58 INITIALIZATION_STATUS_SUCCESS, 58 INITIALIZATION_STATUS_SUCCESS,
59 INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE, 59 INITIALIZATION_STATUS_CREATED_NEW_PREF_STORE,
60 INITIALIZATION_STATUS_ERROR 60 INITIALIZATION_STATUS_ERROR
61 }; 61 };
62 62
63 // A helper class to store all the information associated with a preference. 63 // A helper class to store all the information associated with a preference.
64 class COMPONENTS_PREFS_EXPORT Preference { 64 class BASE_PREFS_EXPORT Preference {
65 public: 65 public:
66 // The type of the preference is determined by the type with which it is 66 // The type of the preference is determined by the type with which it is
67 // registered. This type needs to be a boolean, integer, double, string, 67 // registered. This type needs to be a boolean, integer, double, string,
68 // dictionary (a branch), or list. You shouldn't need to construct this on 68 // dictionary (a branch), or list. You shouldn't need to construct this on
69 // your own; use the PrefService::Register*Pref methods instead. 69 // your own; use the PrefService::Register*Pref methods instead.
70 Preference(const PrefService* service, 70 Preference(const PrefService* service,
71 const std::string& name, 71 const std::string& name,
72 base::Value::Type type); 72 base::Value::Type type);
73 ~Preference() {} 73 ~Preference() {}
74 74
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 const base::Value* GetPreferenceValue(const std::string& path) const; 375 const base::Value* GetPreferenceValue(const std::string& path) const;
376 376
377 // Local cache of registered Preference objects. The pref_registry_ 377 // Local cache of registered Preference objects. The pref_registry_
378 // is authoritative with respect to what the types and default values 378 // is authoritative with respect to what the types and default values
379 // of registered preferences are. 379 // of registered preferences are.
380 mutable PreferenceMap prefs_map_; 380 mutable PreferenceMap prefs_map_;
381 381
382 DISALLOW_COPY_AND_ASSIGN(PrefService); 382 DISALLOW_COPY_AND_ASSIGN(PrefService);
383 }; 383 };
384 384
385 #endif // COMPONENTS_PREFS_PREF_SERVICE_H_ 385 #endif // BASE_PREFS_PREF_SERVICE_H_
OLDNEW
« no previous file with comments | « components/prefs/pref_registry_simple.h ('k') | components/prefs/pref_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698