| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/cros_settings.h" | 5 #include "chrome/browser/chromeos/cros_settings.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/cros_settings_provider.h" | 10 #include "chrome/browser/chromeos/cros_settings_provider.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void CrosSettings::SetBoolean(const std::string& path, bool in_value) { | 56 void CrosSettings::SetBoolean(const std::string& path, bool in_value) { |
| 57 DCHECK(CalledOnValidThread()); | 57 DCHECK(CalledOnValidThread()); |
| 58 Set(path, Value::CreateBooleanValue(in_value)); | 58 Set(path, Value::CreateBooleanValue(in_value)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void CrosSettings::SetInteger(const std::string& path, int in_value) { | 61 void CrosSettings::SetInteger(const std::string& path, int in_value) { |
| 62 DCHECK(CalledOnValidThread()); | 62 DCHECK(CalledOnValidThread()); |
| 63 Set(path, Value::CreateIntegerValue(in_value)); | 63 Set(path, Value::CreateIntegerValue(in_value)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void CrosSettings::SetReal(const std::string& path, double in_value) { | 66 void CrosSettings::SetDouble(const std::string& path, double in_value) { |
| 67 DCHECK(CalledOnValidThread()); | 67 DCHECK(CalledOnValidThread()); |
| 68 Set(path, Value::CreateRealValue(in_value)); | 68 Set(path, Value::CreateDoubleValue(in_value)); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void CrosSettings::SetString(const std::string& path, | 71 void CrosSettings::SetString(const std::string& path, |
| 72 const std::string& in_value) { | 72 const std::string& in_value) { |
| 73 DCHECK(CalledOnValidThread()); | 73 DCHECK(CalledOnValidThread()); |
| 74 Set(path, Value::CreateStringValue(in_value)); | 74 Set(path, Value::CreateStringValue(in_value)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) { | 77 bool CrosSettings::AddSettingsProvider(CrosSettingsProvider* provider) { |
| 78 DCHECK(CalledOnValidThread()); | 78 DCHECK(CalledOnValidThread()); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool CrosSettings::GetInteger(const std::string& path, | 174 bool CrosSettings::GetInteger(const std::string& path, |
| 175 int* out_value) const { | 175 int* out_value) const { |
| 176 DCHECK(CalledOnValidThread()); | 176 DCHECK(CalledOnValidThread()); |
| 177 Value* value; | 177 Value* value; |
| 178 if (!Get(path, &value)) | 178 if (!Get(path, &value)) |
| 179 return false; | 179 return false; |
| 180 | 180 |
| 181 return value->GetAsInteger(out_value); | 181 return value->GetAsInteger(out_value); |
| 182 } | 182 } |
| 183 | 183 |
| 184 bool CrosSettings::GetReal(const std::string& path, | 184 bool CrosSettings::GetDouble(const std::string& path, |
| 185 double* out_value) const { | 185 double* out_value) const { |
| 186 DCHECK(CalledOnValidThread()); | 186 DCHECK(CalledOnValidThread()); |
| 187 Value* value; | 187 Value* value; |
| 188 if (!Get(path, &value)) | 188 if (!Get(path, &value)) |
| 189 return false; | 189 return false; |
| 190 | 190 |
| 191 return value->GetAsReal(out_value); | 191 return value->GetAsDouble(out_value); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool CrosSettings::GetString(const std::string& path, | 194 bool CrosSettings::GetString(const std::string& path, |
| 195 std::string* out_value) const { | 195 std::string* out_value) const { |
| 196 DCHECK(CalledOnValidThread()); | 196 DCHECK(CalledOnValidThread()); |
| 197 Value* value; | 197 Value* value; |
| 198 if (!Get(path, &value)) | 198 if (!Get(path, &value)) |
| 199 return false; | 199 return false; |
| 200 | 200 |
| 201 return value->GetAsString(out_value); | 201 return value->GetAsString(out_value); |
| 202 } | 202 } |
| 203 | 203 |
| 204 CrosSettings::CrosSettings() { | 204 CrosSettings::CrosSettings() { |
| 205 } | 205 } |
| 206 | 206 |
| 207 CrosSettings::~CrosSettings() { | 207 CrosSettings::~CrosSettings() { |
| 208 DCHECK(providers_.empty()); | 208 DCHECK(providers_.empty()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace chromeos | 211 } // namespace chromeos |
| OLD | NEW |