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/policy_map.h" | 5 #include "components/policy/core/common/policy_map.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 | 11 |
12 namespace policy { | 12 namespace policy { |
13 | 13 |
| 14 scoped_ptr<PolicyMap::Entry> PolicyMap::Entry::DeepCopy() const { |
| 15 scoped_ptr<Entry> copy(new Entry); |
| 16 copy->level = level; |
| 17 copy->scope = scope; |
| 18 if (value) |
| 19 copy->value = value->DeepCopy(); |
| 20 if (external_data_fetcher) { |
| 21 copy->external_data_fetcher = |
| 22 new ExternalDataFetcher(*external_data_fetcher); |
| 23 } |
| 24 return copy.Pass(); |
| 25 } |
| 26 |
14 bool PolicyMap::Entry::has_higher_priority_than( | 27 bool PolicyMap::Entry::has_higher_priority_than( |
15 const PolicyMap::Entry& other) const { | 28 const PolicyMap::Entry& other) const { |
16 if (level == other.level) | 29 if (level == other.level) |
17 return scope > other.scope; | 30 return scope > other.scope; |
18 else | 31 else |
19 return level > other.level; | 32 return level > other.level; |
20 } | 33 } |
21 | 34 |
22 bool PolicyMap::Entry::Equals(const PolicyMap::Entry& other) const { | 35 bool PolicyMap::Entry::Equals(const PolicyMap::Entry& other) const { |
23 return level == other.level && | 36 return level == other.level && |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 map_.clear(); | 190 map_.clear(); |
178 } | 191 } |
179 | 192 |
180 // static | 193 // static |
181 bool PolicyMap::MapEntryEquals(const PolicyMap::PolicyMapType::value_type& a, | 194 bool PolicyMap::MapEntryEquals(const PolicyMap::PolicyMapType::value_type& a, |
182 const PolicyMap::PolicyMapType::value_type& b) { | 195 const PolicyMap::PolicyMapType::value_type& b) { |
183 return a.first == b.first && a.second.Equals(b.second); | 196 return a.first == b.first && a.second.Equals(b.second); |
184 } | 197 } |
185 | 198 |
186 } // namespace policy | 199 } // namespace policy |
OLD | NEW |