OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/policy/core/common/schema_map.h" | 5 #include "components/policy/core/common/schema_map.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/policy/core/common/policy_bundle.h" | 9 #include "components/policy/core/common/policy_bundle.h" |
10 #include "components/policy/core/common/policy_map.h" | 10 #include "components/policy/core/common/policy_map.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (!schema->valid()) | 57 if (!schema->valid()) |
58 continue; | 58 continue; |
59 | 59 |
60 PolicyMap* map = it->second; | 60 PolicyMap* map = it->second; |
61 for (PolicyMap::const_iterator it_map = map->begin(); | 61 for (PolicyMap::const_iterator it_map = map->begin(); |
62 it_map != map->end();) { | 62 it_map != map->end();) { |
63 const std::string& policy_name = it_map->first; | 63 const std::string& policy_name = it_map->first; |
64 const base::Value* policy_value = it_map->second.value; | 64 const base::Value* policy_value = it_map->second.value; |
65 Schema policy_schema = schema->GetProperty(policy_name); | 65 Schema policy_schema = schema->GetProperty(policy_name); |
66 ++it_map; | 66 ++it_map; |
| 67 std::string error_path; |
67 std::string error; | 68 std::string error; |
68 if (!policy_value || | 69 if (!policy_value || |
69 !policy_schema.Validate(*policy_value, SCHEMA_STRICT, &error)) { | 70 !policy_schema.Validate(*policy_value, |
| 71 SCHEMA_STRICT, |
| 72 &error_path, |
| 73 &error)) { |
70 LOG(ERROR) << "Dropping policy " << policy_name << " for " | 74 LOG(ERROR) << "Dropping policy " << policy_name << " for " |
71 << it->first.component_id | 75 << it->first.component_id |
72 << " because it's not valid: " << error; | 76 << " because it's not valid: " << error |
| 77 << " at " << error_path; |
73 map->Erase(policy_name); | 78 map->Erase(policy_name); |
74 } | 79 } |
75 } | 80 } |
76 } | 81 } |
77 } | 82 } |
78 | 83 |
79 bool SchemaMap::HasComponents() const { | 84 bool SchemaMap::HasComponents() const { |
80 for (DomainMap::const_iterator domain = map_.begin(); | 85 for (DomainMap::const_iterator domain = map_.begin(); |
81 domain != map_.end(); ++domain) { | 86 domain != map_.end(); ++domain) { |
82 if (domain->first == POLICY_DOMAIN_CHROME) | 87 if (domain->first == POLICY_DOMAIN_CHROME) |
(...skipping 20 matching lines...) Expand all Loading... |
103 for (ComponentMap::const_iterator comp = components.begin(); | 108 for (ComponentMap::const_iterator comp = components.begin(); |
104 comp != components.end(); ++comp) { | 109 comp != components.end(); ++comp) { |
105 PolicyNamespace ns(domain->first, comp->first); | 110 PolicyNamespace ns(domain->first, comp->first); |
106 if (!other->GetSchema(ns)) | 111 if (!other->GetSchema(ns)) |
107 list->push_back(ns); | 112 list->push_back(ns); |
108 } | 113 } |
109 } | 114 } |
110 } | 115 } |
111 | 116 |
112 } // namespace policy | 117 } // namespace policy |
OLD | NEW |