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 #ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ | 5 #ifndef CHROME_BROWSER_PREFS_PREF_REGISTRAR_SIMPLE_H_ |
6 #define CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ | 6 #define CHROME_BROWSER_PREFS_PREF_REGISTRAR_SIMPLE_H_ |
7 | 7 |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include <string> |
9 | 9 |
10 // A simple PrefService implementation. | 10 #include "base/values.h" |
11 class PrefServiceSimple : public PrefService { | 11 |
12 class FilePath; | |
13 class PrefService; | |
14 | |
15 // A class for performing registration of simple types to a standard | |
16 // PrefService. | |
17 class PrefRegistrarSimple { | |
12 public: | 18 public: |
13 // You may wish to use PrefServiceBuilder or one of its subclasses | 19 // Creates a registrar to register preferences with the specified |
14 // for simplified construction. | 20 // PrefService. The caller is responsible for ensuring that the |
15 PrefServiceSimple( | 21 // lifetime of |pref_service| exceeds the lifetime of this object. |
16 PrefNotifierImpl* pref_notifier, | 22 PrefRegistrarSimple(PrefService* pref_service); |
17 PrefValueStore* pref_value_store, | |
18 PersistentPrefStore* user_prefs, | |
19 DefaultPrefStore* default_store, | |
20 base::Callback<void(PersistentPrefStore::PrefReadError)> | |
21 read_error_callback, | |
22 bool async); | |
23 virtual ~PrefServiceSimple(); | |
24 | 23 |
25 void RegisterBooleanPref(const char* path, bool default_value); | 24 void RegisterBooleanPref(const char* path, bool default_value); |
26 void RegisterIntegerPref(const char* path, int default_value); | 25 void RegisterIntegerPref(const char* path, int default_value); |
27 void RegisterDoublePref(const char* path, double default_value); | 26 void RegisterDoublePref(const char* path, double default_value); |
28 void RegisterStringPref(const char* path, const std::string& default_value); | 27 void RegisterStringPref(const char* path, const std::string& default_value); |
29 void RegisterFilePathPref(const char* path, const FilePath& default_value); | 28 void RegisterFilePathPref(const char* path, const FilePath& default_value); |
30 void RegisterListPref(const char* path); | 29 void RegisterListPref(const char* path); |
31 void RegisterDictionaryPref(const char* path); | 30 void RegisterDictionaryPref(const char* path); |
32 void RegisterListPref(const char* path, base::ListValue* default_value); | 31 void RegisterListPref(const char* path, base::ListValue* default_value); |
33 void RegisterDictionaryPref( | 32 void RegisterDictionaryPref( |
34 const char* path, base::DictionaryValue* default_value); | 33 const char* path, base::DictionaryValue* default_value); |
35 void RegisterInt64Pref(const char* path, | 34 void RegisterInt64Pref(const char* path, |
36 int64 default_value); | 35 int64 default_value); |
37 | 36 |
37 void UnregisterPreference(const char* path); | |
38 | |
38 private: | 39 private: |
39 DISALLOW_COPY_AND_ASSIGN(PrefServiceSimple); | 40 PrefService* pref_service_; |
Mattias Nissler (ping if slow)
2013/01/03 13:11:16
Ah, so I had a different thing in mind: Make PrefR
| |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(PrefRegistrarSimple); | |
40 }; | 43 }; |
41 | 44 |
42 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_SIMPLE_H_ | 45 #endif // CHROME_BROWSER_PREFS_PREF_REGISTRAR_SIMPLE_H_ |
OLD | NEW |