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 "chrome/browser/policy/schema_map.h" | 5 #include "chrome/browser/policy/schema_map.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/policy/policy_bundle.h" | 8 #include "chrome/browser/policy/policy_bundle.h" |
9 #include "chrome/browser/policy/policy_map.h" | 9 #include "chrome/browser/policy/policy_map.h" |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 for (DomainMap::const_iterator domain = map_.begin(); | 73 for (DomainMap::const_iterator domain = map_.begin(); |
74 domain != map_.end(); ++domain) { | 74 domain != map_.end(); ++domain) { |
75 if (domain->first == POLICY_DOMAIN_CHROME) | 75 if (domain->first == POLICY_DOMAIN_CHROME) |
76 continue; | 76 continue; |
77 if (!domain->second.empty()) | 77 if (!domain->second.empty()) |
78 return true; | 78 return true; |
79 } | 79 } |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
| 83 void SchemaMap::GetChanges(const scoped_refptr<SchemaMap>& older, |
| 84 PolicyNamespaceList* removed, |
| 85 PolicyNamespaceList* added) const { |
| 86 GetNamespacesNotInOther(older, added); |
| 87 older->GetNamespacesNotInOther(this, removed); |
| 88 } |
| 89 |
| 90 void SchemaMap::GetNamespacesNotInOther(const SchemaMap* other, |
| 91 PolicyNamespaceList* list) const { |
| 92 list->clear(); |
| 93 for (DomainMap::const_iterator domain = map_.begin(); |
| 94 domain != map_.end(); ++domain) { |
| 95 const ComponentMap& components = domain->second; |
| 96 for (ComponentMap::const_iterator comp = components.begin(); |
| 97 comp != components.end(); ++comp) { |
| 98 PolicyNamespace ns(domain->first, comp->first); |
| 99 if (!other->GetSchema(ns)) |
| 100 list->push_back(ns); |
| 101 } |
| 102 } |
| 103 } |
| 104 |
83 } // namespace policy | 105 } // namespace policy |
OLD | NEW |