| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 scoped_ptr<Entry> copy(new Entry); | 28 scoped_ptr<Entry> copy(new Entry); |
| 29 copy->level = level; | 29 copy->level = level; |
| 30 copy->scope = scope; | 30 copy->scope = scope; |
| 31 copy->source = source; | 31 copy->source = source; |
| 32 if (value) | 32 if (value) |
| 33 copy->value = value->DeepCopy(); | 33 copy->value = value->DeepCopy(); |
| 34 if (external_data_fetcher) { | 34 if (external_data_fetcher) { |
| 35 copy->external_data_fetcher = | 35 copy->external_data_fetcher = |
| 36 new ExternalDataFetcher(*external_data_fetcher); | 36 new ExternalDataFetcher(*external_data_fetcher); |
| 37 } | 37 } |
| 38 return copy.Pass(); | 38 return copy; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool PolicyMap::Entry::has_higher_priority_than( | 41 bool PolicyMap::Entry::has_higher_priority_than( |
| 42 const PolicyMap::Entry& other) const { | 42 const PolicyMap::Entry& other) const { |
| 43 if (level == other.level) | 43 if (level == other.level) |
| 44 return scope > other.scope; | 44 return scope > other.scope; |
| 45 else | 45 else |
| 46 return level > other.level; | 46 return level > other.level; |
| 47 } | 47 } |
| 48 | 48 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 map_.clear(); | 210 map_.clear(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 // static | 213 // static |
| 214 bool PolicyMap::MapEntryEquals(const PolicyMap::PolicyMapType::value_type& a, | 214 bool PolicyMap::MapEntryEquals(const PolicyMap::PolicyMapType::value_type& a, |
| 215 const PolicyMap::PolicyMapType::value_type& b) { | 215 const PolicyMap::PolicyMapType::value_type& b) { |
| 216 return a.first == b.first && a.second.Equals(b.second); | 216 return a.first == b.first && a.second.Equals(b.second); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace policy | 219 } // namespace policy |
| OLD | NEW |