Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: components/policy/core/common/policy_map.cc

Issue 2641343002: Use source parameter to determine policy priority. (Closed)
Patch Set: Fix comment format. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_map.h ('k') | components/policy/core/common/policy_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698