Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: remoting/host/json_host_config.cc

Issue 10855249: [Chromoting] The daemon process now starts the networking process and passes the host configuration… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback + rebased on top of https://chromiumcodereview.appspot.com/10829467/ (Patch Set 5) Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698