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

Unified Diff: base/json/json_string_value_serializer.h

Issue 2475583002: Adds option for JSON reader to allow invalid utf characters (Closed)
Patch Set: comment Created 4 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
« no previous file with comments | « base/json/json_reader.h ('k') | base/json/json_string_value_serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_string_value_serializer.h
diff --git a/base/json/json_string_value_serializer.h b/base/json/json_string_value_serializer.h
index a97da23920213797d233fe0296a1c94cfde53207..55a53e207fe2ddd3d0c8e9564b5eb5ecab1f1212 100644
--- a/base/json/json_string_value_serializer.h
+++ b/base/json/json_string_value_serializer.h
@@ -47,8 +47,10 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer {
class BASE_EXPORT JSONStringValueDeserializer : public base::ValueDeserializer {
public:
// This retains a reference to the contents of |json_string|, so the data
- // must outlive the JSONStringValueDeserializer.
- explicit JSONStringValueDeserializer(const base::StringPiece& json_string);
+ // must outlive the JSONStringValueDeserializer. |options| is a bitmask of
+ // JSONParserOptions.
+ explicit JSONStringValueDeserializer(const base::StringPiece& json_string,
+ int options = 0);
~JSONStringValueDeserializer() override;
@@ -62,15 +64,10 @@ class BASE_EXPORT JSONStringValueDeserializer : public base::ValueDeserializer {
std::unique_ptr<base::Value> Deserialize(int* error_code,
std::string* error_message) override;
- void set_allow_trailing_comma(bool new_value) {
- allow_trailing_comma_ = new_value;
- }
-
private:
// Data is owned by the caller of the constructor.
base::StringPiece json_string_;
- // If true, deserialization will allow trailing commas.
- bool allow_trailing_comma_;
+ const int options_;
DISALLOW_COPY_AND_ASSIGN(JSONStringValueDeserializer);
};
« no previous file with comments | « base/json/json_reader.h ('k') | base/json/json_string_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698