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

Unified Diff: base/json/json_value_serializer.h

Issue 8423079: Allow trailing comma in JSON policy files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit testing for the whole JSONValueSerializer suite. Created 9 years, 1 month 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_value_serializer.h
diff --git a/base/json/json_value_serializer.h b/base/json/json_value_serializer.h
index 650008ec235aab6d356098b7c8c5bde0c1f7b224..21ec37a89d2087a46324d5f61dca8cc1efbfa4e8 100644
--- a/base/json/json_value_serializer.h
+++ b/base/json/json_value_serializer.h
@@ -74,7 +74,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
// When deserializing, the file should exist, but when serializing, the
// serializer will attempt to create the file at the specified location.
explicit JSONFileValueSerializer(const FilePath& json_file_path)
- : json_file_path_(json_file_path) {}
+ : json_file_path_(json_file_path),
+ allow_trailing_comma_(false) {}
virtual ~JSONFileValueSerializer() {}
@@ -116,8 +117,13 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
// be a JsonFileError.
static const char* GetErrorMessageForCode(int error_code);
+ void set_allow_trailing_comma(bool new_value) {
+ allow_trailing_comma_ = new_value;
+ }
+
private:
FilePath json_file_path_;
+ bool allow_trailing_comma_;
// A wrapper for file_util::ReadFileToString which returns a non-zero
// JsonFileError if there were file errors.

Powered by Google App Engine
This is Rietveld 408576698