OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <stddef.h> |
| 6 #include <string> |
| 7 |
5 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
6 | |
7 #include "base/json/string_escape.h" | 9 #include "base/json/string_escape.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/string_util.h" | |
10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/string_piece.h" |
| 13 #include "base/stringprintf.h" |
| 14 #include "base/utf_string_conversions.h" |
11 #include "base/values.h" | 15 #include "base/values.h" |
12 #include "base/utf_string_conversions.h" | |
13 | 16 |
14 namespace base { | 17 namespace base { |
15 | 18 |
16 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
17 static const char kPrettyPrintLineEnding[] = "\r\n"; | 20 static const char kPrettyPrintLineEnding[] = "\r\n"; |
18 #else | 21 #else |
19 static const char kPrettyPrintLineEnding[] = "\n"; | 22 static const char kPrettyPrintLineEnding[] = "\n"; |
20 #endif | 23 #endif |
21 | 24 |
22 /* static */ | 25 /* static */ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); | 197 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); |
195 } | 198 } |
196 | 199 |
197 void JSONWriter::IndentLine(int depth) { | 200 void JSONWriter::IndentLine(int depth) { |
198 // It may be faster to keep an indent string so we don't have to keep | 201 // It may be faster to keep an indent string so we don't have to keep |
199 // reallocating. | 202 // reallocating. |
200 json_string_->append(std::string(depth * 3, ' ')); | 203 json_string_->append(std::string(depth * 3, ' ')); |
201 } | 204 } |
202 | 205 |
203 } // namespace base | 206 } // namespace base |
OLD | NEW |