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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 continue; | 98 continue; |
99 if (!domain->second.empty()) | 99 if (!domain->second.empty()) |
100 return true; | 100 return true; |
101 } | 101 } |
102 return false; | 102 return false; |
103 } | 103 } |
104 | 104 |
105 void SchemaMap::GetChanges(const scoped_refptr<SchemaMap>& older, | 105 void SchemaMap::GetChanges(const scoped_refptr<SchemaMap>& older, |
106 PolicyNamespaceList* removed, | 106 PolicyNamespaceList* removed, |
107 PolicyNamespaceList* added) const { | 107 PolicyNamespaceList* added) const { |
108 GetNamespacesNotInOther(older, added); | 108 GetNamespacesNotInOther(older.get(), added); |
109 older->GetNamespacesNotInOther(this, removed); | 109 older->GetNamespacesNotInOther(this, removed); |
110 } | 110 } |
111 | 111 |
112 void SchemaMap::GetNamespacesNotInOther(const SchemaMap* other, | 112 void SchemaMap::GetNamespacesNotInOther(const SchemaMap* other, |
113 PolicyNamespaceList* list) const { | 113 PolicyNamespaceList* list) const { |
114 list->clear(); | 114 list->clear(); |
115 for (DomainMap::const_iterator domain = map_.begin(); | 115 for (DomainMap::const_iterator domain = map_.begin(); |
116 domain != map_.end(); ++domain) { | 116 domain != map_.end(); ++domain) { |
117 const ComponentMap& components = domain->second; | 117 const ComponentMap& components = domain->second; |
118 for (ComponentMap::const_iterator comp = components.begin(); | 118 for (ComponentMap::const_iterator comp = components.begin(); |
119 comp != components.end(); ++comp) { | 119 comp != components.end(); ++comp) { |
120 PolicyNamespace ns(domain->first, comp->first); | 120 PolicyNamespace ns(domain->first, comp->first); |
121 if (!other->GetSchema(ns)) | 121 if (!other->GetSchema(ns)) |
122 list->push_back(ns); | 122 list->push_back(ns); |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 } // namespace policy | 127 } // namespace policy |
OLD | NEW |