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

Unified Diff: base/json/json_value_serializer.h

Issue 8505033: Allow JSONWriter and JSONValueSerializer to omit binary values when instructed to do so. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chrome\browser\policy\configuration_policy_handler_chromeos.cc 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
« no previous file with comments | « no previous file | base/json/json_value_serializer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/json/json_value_serializer.h
diff --git a/base/json/json_value_serializer.h b/base/json/json_value_serializer.h
index 82fd9639c1a2c586a1961bfc7c140af07ea32b72..07d985d812fa307da9f734172ac96b2c05739e22 100644
--- a/base/json/json_value_serializer.h
+++ b/base/json/json_value_serializer.h
@@ -41,6 +41,10 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer {
// into the string passed into the constructor.
virtual bool Serialize(const Value& root) OVERRIDE;
+ // Equivalent to Serialize(root) except binary values are omitted from the
+ // output.
+ bool SerializeAndOmitBinaryValues(const Value& root);
+
// Attempt to deserialize the data structure encoded in the string passed
// in to the constructor into a structure of Value objects. If the return
// value is NULL, and if |error_code| is non-null, |error_code| will
@@ -59,6 +63,8 @@ class BASE_EXPORT JSONStringValueSerializer : public base::ValueSerializer {
}
private:
+ bool SerializeInternal(const Value& root, bool omit_binary_values);
+
std::string* json_string_;
bool initialized_with_const_string_;
bool pretty_print_; // If true, serialization will span multiple lines.
@@ -89,6 +95,10 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
// into the file whose name was passed into the constructor.
virtual bool Serialize(const Value& root) OVERRIDE;
+ // Equivalent to Serialize(root) except binary values are omitted from the
+ // output.
+ bool SerializeAndOmitBinaryValues(const Value& root);
+
// Attempt to deserialize the data structure encoded in the file passed
// in to the constructor into a structure of Value objects. If the return
// value is NULL, and if |error_code| is non-null, |error_code| will
@@ -119,6 +129,8 @@ class BASE_EXPORT JSONFileValueSerializer : public base::ValueSerializer {
static const char* GetErrorMessageForCode(int error_code);
private:
+ bool SerializeInternal(const Value& root, bool omit_binary_values);
+
FilePath json_file_path_;
// A wrapper for file_util::ReadFileToString which returns a non-zero
« no previous file with comments | « no previous file | base/json/json_value_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698