| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 void PolicyDomainDescriptor::RegisterComponent( | 51 void PolicyDomainDescriptor::RegisterComponent( |
| 52 const std::string& component_id, | 52 const std::string& component_id, |
| 53 scoped_ptr<PolicySchema> schema) { | 53 scoped_ptr<PolicySchema> schema) { |
| 54 const PolicySchema*& entry = schema_map_[component_id]; | 54 const PolicySchema*& entry = schema_map_[component_id]; |
| 55 delete entry; | 55 delete entry; |
| 56 entry = schema.release(); | 56 entry = schema.release(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void PolicyDomainDescriptor::FilterBundle(PolicyBundle* bundle) const { | 59 void PolicyDomainDescriptor::FilterBundle(PolicyBundle* bundle) const { |
| 60 // Chrome policies are not filtered, so that typos appear in about:policy. | |
| 61 DCHECK_NE(POLICY_DOMAIN_CHROME, domain_); | |
| 62 | |
| 63 for (PolicyBundle::iterator it_bundle = bundle->begin(); | 60 for (PolicyBundle::iterator it_bundle = bundle->begin(); |
| 64 it_bundle != bundle->end(); ++it_bundle) { | 61 it_bundle != bundle->end(); ++it_bundle) { |
| 65 const PolicyNamespace& ns = it_bundle->first; | 62 const PolicyNamespace& ns = it_bundle->first; |
| 66 if (ns.domain != domain_) | 63 if (ns.domain != domain_) |
| 67 continue; | 64 continue; |
| 68 | 65 |
| 69 SchemaMap::const_iterator it_schema = schema_map_.find(ns.component_id); | 66 SchemaMap::const_iterator it_schema = schema_map_.find(ns.component_id); |
| 70 if (it_schema == schema_map_.end()) { | 67 if (it_schema == schema_map_.end()) { |
| 71 // Component ID not found. | 68 // Component ID not found. |
| 72 it_bundle->second->Clear(); | 69 it_bundle->second->Clear(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 93 map->Erase(policy_name); | 90 map->Erase(policy_name); |
| 94 } | 91 } |
| 95 } | 92 } |
| 96 } | 93 } |
| 97 | 94 |
| 98 PolicyDomainDescriptor::~PolicyDomainDescriptor() { | 95 PolicyDomainDescriptor::~PolicyDomainDescriptor() { |
| 99 STLDeleteValues(&schema_map_); | 96 STLDeleteValues(&schema_map_); |
| 100 } | 97 } |
| 101 | 98 |
| 102 } // namespace policy | 99 } // namespace policy |
| OLD | NEW |