| Index: chrome/browser/prefs/pref_registrar_simple.cc
|
| diff --git a/chrome/browser/prefs/pref_registrar_simple.cc b/chrome/browser/prefs/pref_registrar_simple.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f630c5ce052f1c3d44e92c6120f1267f822077dc
|
| --- /dev/null
|
| +++ b/chrome/browser/prefs/pref_registrar_simple.cc
|
| @@ -0,0 +1,75 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/prefs/pref_registrar_simple.h"
|
| +
|
| +#include "base/file_path.h"
|
| +#include "base/string_number_conversions.h"
|
| +#include "base/values.h"
|
| +#include "chrome/browser/prefs/pref_service.h"
|
| +
|
| +PrefRegistrarSimple::PrefRegistrarSimple(PrefService* pref_service)
|
| + : pref_service_(pref_service) {
|
| + DCHECK(pref_service_->AllowPrefRegistrarSimple());
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterBooleanPref(const char* path,
|
| + bool default_value) {
|
| + pref_service_->RegisterPreference(path,
|
| + Value::CreateBooleanValue(default_value));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterIntegerPref(const char* path,
|
| + int default_value) {
|
| + pref_service_->RegisterPreference(path,
|
| + Value::CreateIntegerValue(default_value));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterDoublePref(const char* path,
|
| + double default_value) {
|
| + pref_service_->RegisterPreference(path,
|
| + Value::CreateDoubleValue(default_value));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterStringPref(const char* path,
|
| + const std::string& default_value) {
|
| + pref_service_->RegisterPreference(path,
|
| + Value::CreateStringValue(default_value));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterFilePathPref(const char* path,
|
| + const FilePath& default_value) {
|
| + pref_service_->RegisterPreference(
|
| + path,
|
| + Value::CreateStringValue(default_value.value()));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterListPref(const char* path) {
|
| + pref_service_->RegisterPreference(path, new ListValue());
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterListPref(const char* path,
|
| + ListValue* default_value) {
|
| + pref_service_->RegisterPreference(path, default_value);
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterDictionaryPref(const char* path) {
|
| + pref_service_->RegisterPreference(path, new DictionaryValue());
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterDictionaryPref(
|
| + const char* path,
|
| + DictionaryValue* default_value) {
|
| + pref_service_->RegisterPreference(path, default_value);
|
| +}
|
| +
|
| +void PrefRegistrarSimple::RegisterInt64Pref(const char* path,
|
| + int64 default_value) {
|
| + pref_service_->RegisterPreference(
|
| + path, Value::CreateStringValue(base::Int64ToString(default_value)));
|
| +}
|
| +
|
| +void PrefRegistrarSimple::UnregisterPreference(const char* path) {
|
| + pref_service_->UnregisterPreference(path);
|
| +}
|
|
|