Chromium Code Reviews| Index: base/json/json_value_serializer.cc |
| diff --git a/base/json/json_value_serializer.cc b/base/json/json_value_serializer.cc |
| index d667bc198e76fe7c19cdc0a3af0667982fbfade0..4f3e9bd3541a1331436fb163d981c29e5300832c 100644 |
| --- a/base/json/json_value_serializer.cc |
| +++ b/base/json/json_value_serializer.cc |
| @@ -17,10 +17,19 @@ const char* JSONFileValueSerializer::kNoSuchFile = "File doesn't exist."; |
| JSONStringValueSerializer::~JSONStringValueSerializer() {} |
| bool JSONStringValueSerializer::Serialize(const Value& root) { |
| + return Serialize(root, false); |
| +} |
| + |
| +bool JSONStringValueSerializer::Serialize(const Value& root, |
| + bool ignore_binary_values) { |
| if (!json_string_ || initialized_with_const_string_) |
| return false; |
| - base::JSONWriter::Write(&root, pretty_print_, json_string_); |
| + base::JSONWriter::Write( |
| + &root, |
|
willchan no longer on Chromium
2011/11/10 18:52:27
Should be 4 space indent. See the example in http:
Eric Dingle
2011/11/10 23:19:57
Done.
|
| + pretty_print_, |
| + ignore_binary_values ? base::JSONWriter::OPTIONS_IGNORE_BINARY_VALUES : 0, |
| + json_string_); |
| return true; |
| } |
| @@ -38,10 +47,15 @@ Value* JSONStringValueSerializer::Deserialize(int* error_code, |
| /******* File Serializer *******/ |
| bool JSONFileValueSerializer::Serialize(const Value& root) { |
| + return Serialize(root, false); |
| +} |
| + |
| +bool JSONFileValueSerializer::Serialize(const Value& root, |
| + bool ignore_binary_values) { |
| std::string json_string; |
| JSONStringValueSerializer serializer(&json_string); |
| serializer.set_pretty_print(true); |
| - bool result = serializer.Serialize(root); |
| + bool result = serializer.Serialize(root, ignore_binary_values); |
| if (!result) |
| return false; |