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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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; | 67 std::string error; |
68 if (!policy_value || | 68 if (!policy_value || |
69 !policy_schema.Validate(*policy_value, SCHEMA_STRICT, &error)) { | 69 !policy_schema.Validate(*policy_value, SCHEMA_STRICT, NULL, &error)) { |
70 LOG(ERROR) << "Dropping policy " << policy_name << " for " | 70 LOG(ERROR) << "Dropping policy " << policy_name << " for " |
71 << it->first.component_id | 71 << it->first.component_id |
72 << " because it's not valid: " << error; | 72 << " because it's not valid: " << error; |
Joao da Silva
2014/01/23 20:59:31
It's a good idea to add the error path to this log
binjin
2014/01/23 21:21:58
Done.
| |
73 map->Erase(policy_name); | 73 map->Erase(policy_name); |
74 } | 74 } |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 bool SchemaMap::HasComponents() const { | 79 bool SchemaMap::HasComponents() const { |
80 for (DomainMap::const_iterator domain = map_.begin(); | 80 for (DomainMap::const_iterator domain = map_.begin(); |
81 domain != map_.end(); ++domain) { | 81 domain != map_.end(); ++domain) { |
82 if (domain->first == POLICY_DOMAIN_CHROME) | 82 if (domain->first == POLICY_DOMAIN_CHROME) |
(...skipping 20 matching lines...) Expand all Loading... | |
103 for (ComponentMap::const_iterator comp = components.begin(); | 103 for (ComponentMap::const_iterator comp = components.begin(); |
104 comp != components.end(); ++comp) { | 104 comp != components.end(); ++comp) { |
105 PolicyNamespace ns(domain->first, comp->first); | 105 PolicyNamespace ns(domain->first, comp->first); |
106 if (!other->GetSchema(ns)) | 106 if (!other->GetSchema(ns)) |
107 list->push_back(ns); | 107 list->push_back(ns); |
108 } | 108 } |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 } // namespace policy | 112 } // namespace policy |
OLD | NEW |