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

Unified Diff: components/policy/core/common/policy_map.cc

Issue 1824743002: Drop non-user policy in ConfigDirPolicyLoader on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/policy_map.cc
diff --git a/components/policy/core/common/policy_map.cc b/components/policy/core/common/policy_map.cc
index b8c58f96cb993f5d0587b1871bf403f21f596c28..55114d76b5adca2f5965f859295fb62056c0b9aa 100644
--- a/components/policy/core/common/policy_map.cc
+++ b/components/policy/core/common/policy_map.cc
@@ -93,6 +93,18 @@ void PolicyMap::Erase(const std::string& policy) {
map_.erase(policy);
}
+void PolicyMap::EraseNonmatching(
+ const base::Callback<bool(const const_iterator)>& filter) {
+ PolicyMapType::iterator iter(map_.begin());
+ while (iter != map_.end()) {
+ if (!filter.Run(iter)) {
+ map_.erase(iter++);
+ } else {
+ ++iter;
+ }
+ }
+}
+
void PolicyMap::Swap(PolicyMap* other) {
map_.swap(other->map_);
}
@@ -156,17 +168,6 @@ void PolicyMap::GetDifferingKeys(const PolicyMap& other,
differing_keys->insert(iter_other->first);
}
-void PolicyMap::FilterLevel(PolicyLevel level) {
- PolicyMapType::iterator iter(map_.begin());
- while (iter != map_.end()) {
- if (iter->second.level != level) {
- map_.erase(iter++);
- } else {
- ++iter;
- }
- }
-}
-
bool PolicyMap::Equals(const PolicyMap& other) const {
return other.size() == size() &&
std::equal(begin(), end(), other.begin(), MapEntryEquals);
« 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