| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/policy_domain_descriptor.h" | 5 #include "chrome/browser/policy/policy_domain_descriptor.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/policy/policy_bundle.h" | 10 #include "chrome/browser/policy/policy_bundle.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 PolicyDomainDescriptor::PolicyDomainDescriptor(PolicyDomain domain) | 48 PolicyDomainDescriptor::PolicyDomainDescriptor(PolicyDomain domain) |
| 49 : domain_(domain) {} | 49 : domain_(domain) {} |
| 50 | 50 |
| 51 const PolicySchema* PolicyDomainDescriptor::get_schema( |
| 52 const std::string& component) const { |
| 53 SchemaMap::const_iterator iter = components().find(component); |
| 54 if (iter != components().end()) |
| 55 return iter->second; |
| 56 return NULL; |
| 57 } |
| 58 |
| 51 void PolicyDomainDescriptor::RegisterComponent( | 59 void PolicyDomainDescriptor::RegisterComponent( |
| 52 const std::string& component_id, | 60 const std::string& component_id, |
| 53 scoped_ptr<PolicySchema> schema) { | 61 scoped_ptr<PolicySchema> schema) { |
| 54 const PolicySchema*& entry = schema_map_[component_id]; | 62 const PolicySchema*& entry = schema_map_[component_id]; |
| 55 delete entry; | 63 delete entry; |
| 56 entry = schema.release(); | 64 entry = schema.release(); |
| 57 } | 65 } |
| 58 | 66 |
| 59 void PolicyDomainDescriptor::FilterBundle(PolicyBundle* bundle) const { | 67 void PolicyDomainDescriptor::FilterBundle(PolicyBundle* bundle) const { |
| 60 for (PolicyBundle::iterator it_bundle = bundle->begin(); | 68 for (PolicyBundle::iterator it_bundle = bundle->begin(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 90 map->Erase(policy_name); | 98 map->Erase(policy_name); |
| 91 } | 99 } |
| 92 } | 100 } |
| 93 } | 101 } |
| 94 | 102 |
| 95 PolicyDomainDescriptor::~PolicyDomainDescriptor() { | 103 PolicyDomainDescriptor::~PolicyDomainDescriptor() { |
| 96 STLDeleteValues(&schema_map_); | 104 STLDeleteValues(&schema_map_); |
| 97 } | 105 } |
| 98 | 106 |
| 99 } // namespace policy | 107 } // namespace policy |
| OLD | NEW |