| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 copy.value = value->CreateDeepCopy(); | 30 copy.value = value->CreateDeepCopy(); |
| 31 if (external_data_fetcher) { | 31 if (external_data_fetcher) { |
| 32 copy.external_data_fetcher.reset( | 32 copy.external_data_fetcher.reset( |
| 33 new ExternalDataFetcher(*external_data_fetcher)); | 33 new ExternalDataFetcher(*external_data_fetcher)); |
| 34 } | 34 } |
| 35 return copy; | 35 return copy; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool PolicyMap::Entry::has_higher_priority_than( | 38 bool PolicyMap::Entry::has_higher_priority_than( |
| 39 const PolicyMap::Entry& other) const { | 39 const PolicyMap::Entry& other) const { |
| 40 if (level == other.level) | 40 if (level == other.level) { |
| 41 if (scope == other.scope) { |
| 42 return source > other.source; |
| 43 } |
| 41 return scope > other.scope; | 44 return scope > other.scope; |
| 42 else | 45 } |
| 43 return level > other.level; | 46 return level > other.level; |
| 44 } | 47 } |
| 45 | 48 |
| 46 bool PolicyMap::Entry::Equals(const PolicyMap::Entry& other) const { | 49 bool PolicyMap::Entry::Equals(const PolicyMap::Entry& other) const { |
| 47 return level == other.level && scope == other.scope && | 50 return level == other.level && scope == other.scope && |
| 48 source == other.source && // Necessary for PolicyUIHandler observers. | 51 source == other.source && // Necessary for PolicyUIHandler observers. |
| 49 // They have to update when sources change. | 52 // They have to update when sources change. |
| 50 base::Value::Equals(value.get(), other.value.get()) && | 53 base::Value::Equals(value.get(), other.value.get()) && |
| 51 ExternalDataFetcher::Equals(external_data_fetcher.get(), | 54 ExternalDataFetcher::Equals(external_data_fetcher.get(), |
| 52 other.external_data_fetcher.get()); | 55 other.external_data_fetcher.get()); |
| 53 } | 56 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 while (iter != map_.end()) { | 213 while (iter != map_.end()) { |
| 211 if (filter.Run(iter) == deletion_value) { | 214 if (filter.Run(iter) == deletion_value) { |
| 212 map_.erase(iter++); | 215 map_.erase(iter++); |
| 213 } else { | 216 } else { |
| 214 ++iter; | 217 ++iter; |
| 215 } | 218 } |
| 216 } | 219 } |
| 217 } | 220 } |
| 218 | 221 |
| 219 } // namespace policy | 222 } // namespace policy |
| OLD | NEW |