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

Unified Diff: components/policy/core/common/schema.h

Issue 171403004: Add touch flag to output of Schema::Normalize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split-1
Patch Set: rebase Created 6 years, 10 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: components/policy/core/common/schema.h
diff --git a/components/policy/core/common/schema.h b/components/policy/core/common/schema.h
index 2d922000a1cbc700ba34fbefdd3cefffe9673de7..82ee38fca63ee7d3a8f74512a2e0cd30b5332815 100644
--- a/components/policy/core/common/schema.h
+++ b/components/policy/core/common/schema.h
@@ -26,6 +26,12 @@ struct POLICY_EXPORT PropertiesNode;
// the strategy to handle unknown properties or invalid values for dict type.
// Note that in Schema::Normalize() allowed errors will be dropped and thus
// ignored.
+// Unknown error indicates that some value in a dictionary (may or may not be
+// the one in root) have unknown property name according to schema.
+// Invalid error indicates a validation failure against the schema. As
+// validation is done recursively, a validation failure of dict properties or
+// list items might be ignored (or dropped in Normalize()) or trigger whole
+// dictionary/list validation failure.
enum SchemaOnErrorStrategy {
// No errors will be allowed.
SCHEMA_STRICT = 0,
@@ -90,11 +96,18 @@ class POLICY_EXPORT Schema {
std::string* error_path,
std::string* error) const;
- // Same as Validate() but drop values with errors instead of ignoring them.
+ // Similar to Validate() but drop values with errors instead of ignoring them.
+ // |changed| is a pointer to a boolean value, and indicate whether |value|
+ // is changed or not (probably dropped properties or items). Be sure to set
+ // the bool that |changed| pointed to to false before calling Normalize().
+ // |changed| can be NULL and in that case no boolean will be set.
+ // This function will also take the ownership of dropped base::Value and
+ // destroy them.
bool Normalize(base::Value* value,
SchemaOnErrorStrategy strategy,
std::string* error_path,
- std::string* error) const;
+ std::string* error,
+ bool* changed) const;
// Used to iterate over the known properties of TYPE_DICTIONARY schemas.
class POLICY_EXPORT Iterator {
« no previous file with comments | « components/policy/core/browser/configuration_policy_handler.cc ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698