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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const base::Value* policy_value = it_map->second.value.get(); | 63 const base::Value* policy_value = it_map->second.value.get(); |
64 Schema policy_schema = schema->GetProperty(policy_name); | 64 Schema policy_schema = schema->GetProperty(policy_name); |
65 ++it_map; | 65 ++it_map; |
66 std::string error_path; | 66 std::string error_path; |
67 std::string error; | 67 std::string error; |
68 if (!policy_value || | 68 if (!policy_value || |
69 !policy_schema.Validate(*policy_value, | 69 !policy_schema.Validate(*policy_value, |
70 SCHEMA_STRICT, | 70 SCHEMA_STRICT, |
71 &error_path, | 71 &error_path, |
72 &error)) { | 72 &error)) { |
73 LOG(ERROR) << "Dropping policy " << policy_name << " for " | 73 LOG(ERROR) << "Dropping policy " << policy_name << " of component " |
74 << it->first.component_id | 74 << it->first.component_id << " due to error at " |
75 << " because it's not valid: " << error | 75 << (error_path.empty() ? "root" : error_path) << ": " |
76 << " at " << error_path; | 76 << error; |
77 map->Erase(policy_name); | 77 map->Erase(policy_name); |
78 } | 78 } |
79 } | 79 } |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 bool SchemaMap::HasComponents() const { | 83 bool SchemaMap::HasComponents() const { |
84 for (DomainMap::const_iterator domain = map_.begin(); | 84 for (DomainMap::const_iterator domain = map_.begin(); |
85 domain != map_.end(); ++domain) { | 85 domain != map_.end(); ++domain) { |
86 if (domain->first == POLICY_DOMAIN_CHROME) | 86 if (domain->first == POLICY_DOMAIN_CHROME) |
(...skipping 20 matching lines...) Expand all Loading... |
107 for (ComponentMap::const_iterator comp = components.begin(); | 107 for (ComponentMap::const_iterator comp = components.begin(); |
108 comp != components.end(); ++comp) { | 108 comp != components.end(); ++comp) { |
109 PolicyNamespace ns(domain->first, comp->first); | 109 PolicyNamespace ns(domain->first, comp->first); |
110 if (!other->GetSchema(ns)) | 110 if (!other->GetSchema(ns)) |
111 list->push_back(ns); | 111 list->push_back(ns); |
112 } | 112 } |
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 } // namespace policy | 116 } // namespace policy |
OLD | NEW |