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/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(const char* path, |
| 50 const FilePath& default_value) { |
| 51 RegisterPreference(path, Value::CreateStringValue(default_value.value())); |
| 52 } |
| 53 |
| 54 void PrefServiceSimple::RegisterListPref(const char* path) { |
| 55 RegisterPreference(path, new ListValue()); |
| 56 } |
| 57 |
| 58 void PrefServiceSimple::RegisterListPref(const char* path, |
| 59 ListValue* default_value) { |
| 60 RegisterPreference(path, default_value); |
| 61 } |
| 62 |
| 63 void PrefServiceSimple::RegisterDictionaryPref(const char* path) { |
| 64 RegisterPreference(path, new DictionaryValue()); |
| 65 } |
| 66 |
| 67 void PrefServiceSimple::RegisterDictionaryPref(const char* path, |
| 68 DictionaryValue* default_value) { |
| 69 RegisterPreference(path, default_value); |
| 70 } |
| 71 |
| 72 void PrefServiceSimple::RegisterInt64Pref(const char* path, |
| 73 int64 default_value) { |
| 74 RegisterPreference( |
| 75 path, Value::CreateStringValue(base::Int64ToString(default_value))); |
| 76 } |
OLD | NEW |