Index: chrome/browser/chromeos/cros_settings.cc |
diff --git a/chrome/browser/chromeos/cros_settings.cc b/chrome/browser/chromeos/cros_settings.cc |
index 7162907fe0a1679e1cbad666d322872c1c073f01..64cac072d3d73a55b2db87b8ca59603f26222654 100644 |
--- a/chrome/browser/chromeos/cros_settings.cc |
+++ b/chrome/browser/chromeos/cros_settings.cc |
@@ -47,7 +47,7 @@ void CrosSettings::FireObservers(const char* path) { |
} |
} |
-void CrosSettings::Set(const std::string& path, Value* in_value) { |
+void CrosSettings::Set(const std::string& path, const base::Value& in_value) { |
DCHECK(CalledOnValidThread()); |
CrosSettingsProvider* provider; |
provider = GetProvider(path); |
@@ -58,23 +58,47 @@ void CrosSettings::Set(const std::string& path, Value* in_value) { |
void CrosSettings::SetBoolean(const std::string& path, bool in_value) { |
DCHECK(CalledOnValidThread()); |
- Set(path, Value::CreateBooleanValue(in_value)); |
+ base::FundamentalValue value(in_value); |
+ Set(path, value); |
Denis Lagno
2011/10/13 13:43:10
nit: why not pass const reference to temporary obj
Mattias Nissler (ping if slow)
2011/10/13 14:49:52
clang won't like it.
pastarmovj
2011/10/26 15:44:59
Exactly, sad but true fact :(
|
} |
void CrosSettings::SetInteger(const std::string& path, int in_value) { |
DCHECK(CalledOnValidThread()); |
- Set(path, Value::CreateIntegerValue(in_value)); |
+ base::FundamentalValue value(in_value); |
+ Set(path, value); |
Denis Lagno
2011/10/13 13:43:10
ditto
|
} |
void CrosSettings::SetDouble(const std::string& path, double in_value) { |
DCHECK(CalledOnValidThread()); |
- Set(path, Value::CreateDoubleValue(in_value)); |
+ base::FundamentalValue value(in_value); |
+ Set(path, value); |
Denis Lagno
2011/10/13 13:43:10
ditto
|
} |
void CrosSettings::SetString(const std::string& path, |
const std::string& in_value) { |
DCHECK(CalledOnValidThread()); |
- Set(path, Value::CreateStringValue(in_value)); |
+ base::StringValue value(in_value); |
+ Set(path, value); |
Denis Lagno
2011/10/13 13:43:10
ditto
|
+} |
+ |
+void CrosSettings::AppendToList(const std::string& path, |
+ const base::Value& value) { |
+ DCHECK(CalledOnValidThread()); |
+ const base::Value* old_value = GetPref(path); |
+ scoped_ptr<base::Value> new_value( |
+ old_value ? old_value->DeepCopy() : new base::ListValue()); |
+ static_cast<base::ListValue*>(new_value.get())->Append(value.DeepCopy()); |
+ Set(path, *new_value); |
+} |
+ |
+void CrosSettings::RemoveFromList(const std::string& path, |
+ const base::Value& value) { |
+ DCHECK(CalledOnValidThread()); |
+ const base::Value* old_value = GetPref(path); |
+ scoped_ptr<base::Value> new_value( |
+ old_value ? old_value->DeepCopy() : new base::ListValue()); |
+ static_cast<base::ListValue*>(new_value.get())->Remove(value, NULL); |
+ Set(path, *new_value); |
} |
bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) { |