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

Unified Diff: chrome/browser/policy/policy_domain_descriptor.cc

Issue 50143010: Added a SchemaMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-5-ref-counted-schema
Patch Set: rebase Created 7 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 | chrome/browser/policy/schema_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_domain_descriptor.cc
diff --git a/chrome/browser/policy/policy_domain_descriptor.cc b/chrome/browser/policy/policy_domain_descriptor.cc
index 3719860fc4eaf094a63823a1deddc07d1d00001f..e2bee4ae5f8d59da955d77b3a96306e4016c452d 100644
--- a/chrome/browser/policy/policy_domain_descriptor.cc
+++ b/chrome/browser/policy/policy_domain_descriptor.cc
@@ -12,38 +12,6 @@
namespace policy {
-namespace {
-
-bool Matches(Schema schema, const base::Value& value) {
- if (!schema.valid()) {
- // Schema not found, invalid entry.
- return false;
- }
-
- if (!value.IsType(schema.type()))
- return false;
-
- const base::DictionaryValue* dict = NULL;
- const base::ListValue* list = NULL;
- if (value.GetAsDictionary(&dict)) {
- for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd();
- it.Advance()) {
- if (!Matches(schema.GetProperty(it.key()), it.value()))
- return false;
- }
- } else if (value.GetAsList(&list)) {
- for (base::ListValue::const_iterator it = list->begin();
- it != list->end(); ++it) {
- if (!*it || !Matches(schema.GetItems(), **it))
- return false;
- }
- }
-
- return true;
-}
-
-} // namespace
-
PolicyDomainDescriptor::PolicyDomainDescriptor(PolicyDomain domain)
: domain_(domain) {}
@@ -84,7 +52,7 @@ void PolicyDomainDescriptor::FilterBundle(PolicyBundle* bundle) const {
const base::Value* policy_value = it_map->second.value;
Schema policy_schema = schema.GetProperty(policy_name);
++it_map;
- if (!policy_value || !Matches(policy_schema, *policy_value))
+ if (!policy_value || !policy_schema.Validate(*policy_value))
map->Erase(policy_name);
}
}
« no previous file with comments | « no previous file | chrome/browser/policy/schema_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698