diff options
Diffstat (limited to 'remoting/host/json_host_config.cc')
-rw-r--r-- | remoting/host/json_host_config.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/remoting/host/json_host_config.cc b/remoting/host/json_host_config.cc index 6c5c2e8..1f22adf 100644 --- a/remoting/host/json_host_config.cc +++ b/remoting/host/json_host_config.cc @@ -45,14 +45,17 @@ bool JsonHostConfig::Read() { bool JsonHostConfig::Save() { DCHECK(CalledOnValidThread()); - std::string file_content; - base::JSONWriter::WriteWithOptions(values_.get(), - base::JSONWriter::OPTIONS_PRETTY_PRINT, - &file_content); + std::string file_content = GetSerializedData(); // TODO(sergeyu): Move ImportantFileWriter to base and use it here. - int result = file_util::WriteFile(filename_, file_content.c_str(), + int result = file_util::WriteFile(filename_, file_content.data(), file_content.size()); return result == static_cast<int>(file_content.size()); } +std::string JsonHostConfig::GetSerializedData() { + std::string data; + base::JSONWriter::Write(values_.get(), &data); + return data; +} + } // namespace remoting |