Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: base/json/json_string_value_serializer.cc

Issue 9590002: JSONWriter cleanup: integrate pretty print into write options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge conflict 7. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/json/json_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_string_value_serializer.cc
diff --git a/base/json/json_string_value_serializer.cc b/base/json/json_string_value_serializer.cc
index 94e660e0c69840788db11055831163eaf0e196e3..3045fa5a57f560a19db2366c491d11f32aee9980 100644
--- a/base/json/json_string_value_serializer.cc
+++ b/base/json/json_string_value_serializer.cc
@@ -24,11 +24,13 @@ bool JSONStringValueSerializer::SerializeInternal(const Value& root,
if (!json_string_ || initialized_with_const_string_)
return false;
- base::JSONWriter::WriteWithOptions(
- &root,
- pretty_print_,
- omit_binary_values ? base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES : 0,
- json_string_);
+ int options = 0;
+ if (omit_binary_values)
+ options |= base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES;
+ if (pretty_print_)
+ options |= base::JSONWriter::OPTIONS_PRETTY_PRINT;
+
+ base::JSONWriter::WriteWithOptions(&root, options, json_string_);
return true;
}
@@ -42,4 +44,3 @@ Value* JSONStringValueSerializer::Deserialize(int* error_code,
error_code,
error_str);
}
-
« no previous file with comments | « no previous file | base/json/json_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698