Chromium Code Reviews| 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 PolicyLevel level, | 71 PolicyLevel level, |
| 72 PolicyScope scope, | 72 PolicyScope scope, |
| 73 PolicySource source, | 73 PolicySource source, |
| 74 std::unique_ptr<base::Value> value, | 74 std::unique_ptr<base::Value> value, |
| 75 std::unique_ptr<ExternalDataFetcher> external_data_fetcher); | 75 std::unique_ptr<ExternalDataFetcher> external_data_fetcher); |
| 76 void Set(const std::string& policy, Entry entry); | 76 void Set(const std::string& policy, Entry entry); |
| 77 | 77 |
| 78 // Erase the given |policy|, if it exists in this map. | 78 // Erase the given |policy|, if it exists in this map. |
| 79 void Erase(const std::string& policy); | 79 void Erase(const std::string& policy); |
| 80 | 80 |
| 81 // Erase all entries for which |filter| returns true. | |
| 82 void EraseMatching(const base::Callback<bool(const const_iterator)>& filter); | |
| 83 | |
| 81 // Erase all entries for which |filter| returns false. | 84 // Erase all entries for which |filter| returns false. |
| 82 void EraseNonmatching( | 85 void EraseNonmatching( |
| 83 const base::Callback<bool(const const_iterator)>& filter); | 86 const base::Callback<bool(const const_iterator)>& filter); |
| 84 | 87 |
| 85 // Swaps the internal representation of |this| with |other|. | 88 // Swaps the internal representation of |this| with |other|. |
| 86 void Swap(PolicyMap* other); | 89 void Swap(PolicyMap* other); |
| 87 | 90 |
| 88 // |this| becomes a copy of |other|. Any existing policies are dropped. | 91 // |this| becomes a copy of |other|. Any existing policies are dropped. |
| 89 void CopyFrom(const PolicyMap& other); | 92 void CopyFrom(const PolicyMap& other); |
| 90 | 93 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 118 | 121 |
| 119 const_iterator begin() const; | 122 const_iterator begin() const; |
| 120 const_iterator end() const; | 123 const_iterator end() const; |
| 121 void Clear(); | 124 void Clear(); |
| 122 | 125 |
| 123 private: | 126 private: |
| 124 // Helper function for Equals(). | 127 // Helper function for Equals(). |
| 125 static bool MapEntryEquals(const PolicyMapType::value_type& a, | 128 static bool MapEntryEquals(const PolicyMapType::value_type& a, |
| 126 const PolicyMapType::value_type& b); | 129 const PolicyMapType::value_type& b); |
| 127 | 130 |
| 131 // Erase all entries for which |filter| returns |deletion_value|. | |
| 132 void EraseGeneric(const base::Callback<bool(const const_iterator)>& filter, | |
|
pastarmovj
2016/10/18 16:20:11
nit: I don't like this name much but I can't come
Thiemo Nagel
2016/10/18 16:31:50
I wasn't happy with FilterGeneric() either. Using
| |
| 133 bool deletion_value); | |
| 134 | |
| 128 PolicyMapType map_; | 135 PolicyMapType map_; |
| 129 | 136 |
| 130 DISALLOW_COPY_AND_ASSIGN(PolicyMap); | 137 DISALLOW_COPY_AND_ASSIGN(PolicyMap); |
| 131 }; | 138 }; |
| 132 | 139 |
| 133 } // namespace policy | 140 } // namespace policy |
| 134 | 141 |
| 135 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ | 142 #endif // COMPONENTS_POLICY_CORE_COMMON_POLICY_MAP_H_ |
| OLD | NEW |