OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/prefs/pref_service.h" | |
6 | |
7 #include "base/file_path.h" | |
8 #include "base/strings/string_number_conversions.h" | |
9 #include "base/values.h" | |
10 | |
11 PrefServiceSimple::PrefServiceSimple( | |
12 PrefNotifierImpl* pref_notifier, | |
13 PrefValueStore* pref_value_store, | |
14 PersistentPrefStore* user_prefs, | |
15 DefaultPrefStore* default_store, | |
16 base::Callback<void(PersistentPrefStore::PrefReadError)> | |
17 read_error_callback, | |
18 bool async) | |
19 : PrefService(pref_notifier, | |
20 pref_value_store, | |
21 user_prefs, | |
22 default_store, | |
23 read_error_callback, | |
24 async) { | |
25 } | |
26 | |
27 PrefServiceSimple::~PrefServiceSimple() {} | |
28 | |
29 void PrefServiceSimple::RegisterBooleanPref(const char* path, | |
30 bool default_value) { | |
31 RegisterPreference(path, Value::CreateBooleanValue(default_value)); | |
32 } | |
33 | |
34 void PrefServiceSimple::RegisterIntegerPref(const char* path, | |
35 int default_value) { | |
36 RegisterPreference(path, Value::CreateIntegerValue(default_value)); | |
37 } | |
38 | |
39 void PrefServiceSimple::RegisterDoublePref(const char* path, | |
40 double default_value) { | |
41 RegisterPreference(path, Value::CreateDoubleValue(default_value)); | |
42 } | |
43 | |
44 void PrefServiceSimple::RegisterStringPref(const char* path, | |
45 const std::string& default_value) { | |
46 RegisterPreference(path, Value::CreateStringValue(default_value)); | |
47 } | |
48 | |
49 void PrefServiceSimple::RegisterFilePathPref( | |
50 const char* path, | |
51 const base::FilePath& default_value) { | |
52 RegisterPreference(path, Value::CreateStringValue(default_value.value())); | |
53 } | |
54 | |
55 void PrefServiceSimple::RegisterListPref(const char* path) { | |
56 RegisterPreference(path, new ListValue()); | |
57 } | |
58 | |
59 void PrefServiceSimple::RegisterListPref(const char* path, | |
60 ListValue* default_value) { | |
61 RegisterPreference(path, default_value); | |
62 } | |
63 | |
64 void PrefServiceSimple::RegisterDictionaryPref(const char* path) { | |
65 RegisterPreference(path, new DictionaryValue()); | |
66 } | |
67 | |
68 void PrefServiceSimple::RegisterDictionaryPref(const char* path, | |
69 DictionaryValue* default_value) { | |
70 RegisterPreference(path, default_value); | |
71 } | |
72 | |
73 void PrefServiceSimple::RegisterInt64Pref(const char* path, | |
74 int64 default_value) { | |
75 RegisterPreference( | |
76 path, Value::CreateStringValue(base::Int64ToString(default_value))); | |
77 } | |
OLD | NEW |