OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/host/json_host_config.h" | 5 #include "remoting/host/json_host_config.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 void JsonHostConfig::Save() { | 45 void JsonHostConfig::Save() { |
46 message_loop_proxy_->PostTask( | 46 message_loop_proxy_->PostTask( |
47 FROM_HERE, base::Bind(&JsonHostConfig::DoWrite, this)); | 47 FROM_HERE, base::Bind(&JsonHostConfig::DoWrite, this)); |
48 } | 48 } |
49 | 49 |
50 void JsonHostConfig::DoWrite() { | 50 void JsonHostConfig::DoWrite() { |
51 std::string file_content; | 51 std::string file_content; |
52 base::AutoLock auto_lock(lock_); | 52 base::AutoLock auto_lock(lock_); |
53 base::JSONWriter::Write(values_.get(), true, &file_content); | 53 base::JSONWriter::WriteWithOptions(values_.get(), |
| 54 base::JSONWriter::OPTIONS_PRETTY_PRINT, |
| 55 &file_content); |
54 // TODO(sergeyu): Move ImportantFileWriter to base and use it here. | 56 // TODO(sergeyu): Move ImportantFileWriter to base and use it here. |
55 file_util::WriteFile(filename_, file_content.c_str(), file_content.size()); | 57 file_util::WriteFile(filename_, file_content.c_str(), file_content.size()); |
56 } | 58 } |
57 | 59 |
58 } // namespace remoting | 60 } // namespace remoting |
OLD | NEW |