| Index: remoting/host/json_host_config.cc
|
| diff --git a/remoting/host/json_host_config.cc b/remoting/host/json_host_config.cc
|
| index 1f22adf5ef03da50561d657f36337c3f0b24b3e2..a73e574a6cd2f76c9305e8a6c689806e2676ed43 100644
|
| --- a/remoting/host/json_host_config.cc
|
| +++ b/remoting/host/json_host_config.cc
|
| @@ -30,16 +30,7 @@ bool JsonHostConfig::Read() {
|
| return false;
|
| }
|
|
|
| - scoped_ptr<Value> value(
|
| - base::JSONReader::Read(file_content, base::JSON_ALLOW_TRAILING_COMMAS));
|
| - if (value.get() == NULL || !value->IsType(Value::TYPE_DICTIONARY)) {
|
| - LOG(WARNING) << "Failed to parse " << filename_.value();
|
| - return false;
|
| - }
|
| -
|
| - DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.release());
|
| - values_.reset(dictionary);
|
| - return true;
|
| + return SetSerializedData(file_content);
|
| }
|
|
|
| bool JsonHostConfig::Save() {
|
| @@ -58,4 +49,17 @@ std::string JsonHostConfig::GetSerializedData() {
|
| return data;
|
| }
|
|
|
| +bool JsonHostConfig::SetSerializedData(const std::string& config) {
|
| + scoped_ptr<Value> value(
|
| + base::JSONReader::Read(config, base::JSON_ALLOW_TRAILING_COMMAS));
|
| + if (value.get() == NULL || !value->IsType(Value::TYPE_DICTIONARY)) {
|
| + LOG(WARNING) << "Failed to parse " << filename_.value();
|
| + return false;
|
| + }
|
| +
|
| + DictionaryValue* dictionary = static_cast<DictionaryValue*>(value.release());
|
| + values_.reset(dictionary);
|
| + return true;
|
| +}
|
| +
|
| } // namespace remoting
|
|
|