Chromium Code Reviews| 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_registry_simple.h" | |
| 6 | |
| 7 #include "base/file_path.h" | |
| 8 #include "base/string_number_conversions.h" | |
| 9 #include "base/values.h" | |
| 10 | |
| 11 PrefRegistrySimple::PrefRegistrySimple() { | |
| 12 } | |
| 13 | |
| 14 void PrefRegistrySimple::RegisterBooleanPref(const char* path, | |
| 15 bool default_value) { | |
| 16 RegisterPreference(path, Value::CreateBooleanValue(default_value)); | |
|
Mattias Nissler (ping if slow)
2013/01/29 18:10:45
nit: namespace-qualify base::Value (here and elsew
Jói
2013/01/30 14:23:33
Done.
| |
| 17 } | |
| 18 | |
| 19 void PrefRegistrySimple::RegisterIntegerPref(const char* path, | |
| 20 int default_value) { | |
| 21 RegisterPreference(path, Value::CreateIntegerValue(default_value)); | |
| 22 } | |
| 23 | |
| 24 void PrefRegistrySimple::RegisterDoublePref(const char* path, | |
| 25 double default_value) { | |
| 26 RegisterPreference(path, Value::CreateDoubleValue(default_value)); | |
| 27 } | |
| 28 | |
| 29 void PrefRegistrySimple::RegisterStringPref(const char* path, | |
| 30 const std::string& default_value) { | |
| 31 RegisterPreference(path, Value::CreateStringValue(default_value)); | |
| 32 } | |
| 33 | |
| 34 void PrefRegistrySimple::RegisterFilePathPref(const char* path, | |
| 35 const FilePath& default_value) { | |
| 36 RegisterPreference(path, Value::CreateStringValue(default_value.value())); | |
| 37 } | |
| 38 | |
| 39 void PrefRegistrySimple::RegisterListPref(const char* path) { | |
| 40 RegisterPreference(path, new ListValue()); | |
| 41 } | |
| 42 | |
| 43 void PrefRegistrySimple::RegisterListPref(const char* path, | |
| 44 ListValue* default_value) { | |
| 45 RegisterPreference(path, default_value); | |
| 46 } | |
| 47 | |
| 48 void PrefRegistrySimple::RegisterDictionaryPref(const char* path) { | |
| 49 RegisterPreference(path, new DictionaryValue()); | |
| 50 } | |
| 51 | |
| 52 void PrefRegistrySimple::RegisterDictionaryPref( | |
| 53 const char* path, | |
| 54 DictionaryValue* default_value) { | |
| 55 RegisterPreference(path, default_value); | |
| 56 } | |
| 57 | |
| 58 void PrefRegistrySimple::RegisterInt64Pref(const char* path, | |
| 59 int64 default_value) { | |
| 60 RegisterPreference( | |
| 61 path, Value::CreateStringValue(base::Int64ToString(default_value))); | |
| 62 } | |
| OLD | NEW |