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

Unified Diff: base/json/json_reader.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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
Index: base/json/json_reader.cc
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index c9f6e76ffb6904d07afa6d5445bc49bac92eb472..34574788671043c836dc88746810634de6719c32 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -93,18 +93,24 @@ JSONReader::JSONReader()
error_col_(0) {}
// static
+Value* JSONReader::Read(const std::string& json) {
+ return Read(json, JSON_PARSE_RFC);
+}
+
+// static
Value* JSONReader::Read(const std::string& json,
- bool allow_trailing_comma) {
- return ReadAndReturnError(json, allow_trailing_comma, NULL, NULL);
+ int options) {
+ return ReadAndReturnError(json, options, NULL, NULL);
}
// static
Value* JSONReader::ReadAndReturnError(const std::string& json,
- bool allow_trailing_comma,
+ int options,
int* error_code_out,
std::string* error_msg_out) {
JSONReader reader = JSONReader();
- Value* root = reader.JsonToValue(json, true, allow_trailing_comma);
+ Value* root = reader.JsonToValue(json, false,
+ (options & JSON_ALLOW_TRAILING_COMMAS) != 0);
if (root)
return root;

Powered by Google App Engine
This is Rietveld 408576698