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

Unified Diff: chrome/browser/policy/policy_bundle.cc

Issue 10384145: Removed ConfigurationPolicyProvider::Provide(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebased Created 8 years, 7 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 | « chrome/browser/policy/policy_bundle.h ('k') | chrome/browser/policy/policy_bundle_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/policy_bundle.cc
diff --git a/chrome/browser/policy/policy_bundle.cc b/chrome/browser/policy/policy_bundle.cc
index ed852cd79a6d6b0e383f46104821b436102d0b80..b58971487ea31080cd2b2705ea74abe3ebc73fec 100644
--- a/chrome/browser/policy/policy_bundle.cc
+++ b/chrome/browser/policy/policy_bundle.cc
@@ -86,6 +86,31 @@ void PolicyBundle::MergeFrom(const PolicyBundle& other) {
}
}
+bool PolicyBundle::Equals(const PolicyBundle& other) const {
+ // Equals() has the peculiarity that an entry with an empty PolicyMap equals
+ // an non-existant entry. This handles usage of non-const Get() that doesn't
+ // insert any policies.
+ const_iterator it_this = begin();
+ const_iterator it_other = other.begin();
+
+ while (true) {
+ // Skip empty PolicyMaps.
+ while (it_this != end() && it_this->second->empty())
+ ++it_this;
+ while (it_other != other.end() && it_other->second->empty())
+ ++it_other;
+ if (it_this == end() || it_other == other.end())
+ break;
+ if (it_this->first != it_other->first ||
+ !it_this->second->Equals(*it_other->second)) {
+ return false;
+ }
+ ++it_this;
+ ++it_other;
+ }
+ return it_this == end() && it_other == other.end();
+}
+
PolicyBundle::const_iterator PolicyBundle::begin() const {
return policy_bundle_.begin();
}
« no previous file with comments | « chrome/browser/policy/policy_bundle.h ('k') | chrome/browser/policy/policy_bundle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698