OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/json/json_writer.h" | 5 #include "base/json/json_writer.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/utf_string_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "base/utf_string_conversions.h" | |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 | 17 |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 static const char kPrettyPrintLineEnding[] = "\r\n"; | 19 static const char kPrettyPrintLineEnding[] = "\r\n"; |
20 #else | 20 #else |
21 static const char kPrettyPrintLineEnding[] = "\n"; | 21 static const char kPrettyPrintLineEnding[] = "\n"; |
22 #endif | 22 #endif |
23 | 23 |
24 /* static */ | 24 /* static */ |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); | 224 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); |
225 } | 225 } |
226 | 226 |
227 void JSONWriter::IndentLine(int depth) { | 227 void JSONWriter::IndentLine(int depth) { |
228 // It may be faster to keep an indent string so we don't have to keep | 228 // It may be faster to keep an indent string so we don't have to keep |
229 // reallocating. | 229 // reallocating. |
230 json_string_->append(std::string(depth * 3, ' ')); | 230 json_string_->append(std::string(depth * 3, ' ')); |
231 } | 231 } |
232 | 232 |
233 } // namespace base | 233 } // namespace base |
OLD | NEW |