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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/policy/policy_bundle.h" 5 #include "chrome/browser/policy/policy_bundle.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/policy/policy_map.h" 9 #include "chrome/browser/policy/policy_map.h"
10 10
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Add extra PolicyMaps at the end. 79 // Add extra PolicyMaps at the end.
80 while (it_other != end_other) { 80 while (it_other != end_other) {
81 PolicyMap*& policy = policy_bundle_[it_other->first]; 81 PolicyMap*& policy = policy_bundle_[it_other->first];
82 DCHECK(!policy); 82 DCHECK(!policy);
83 policy = new PolicyMap(); 83 policy = new PolicyMap();
84 policy->CopyFrom(*it_other->second); 84 policy->CopyFrom(*it_other->second);
85 ++it_other; 85 ++it_other;
86 } 86 }
87 } 87 }
88 88
89 bool PolicyBundle::Equals(const PolicyBundle& other) const {
90 // Equals() has the peculiarity that an entry with an empty PolicyMap equals
91 // an non-existant entry. This handles usage of non-const Get() that doesn't
92 // insert any policies.
93 const_iterator it_this = begin();
94 const_iterator it_other = other.begin();
95
96 while (true) {
97 // Skip empty PolicyMaps.
98 while (it_this != end() && it_this->second->empty())
99 ++it_this;
100 while (it_other != other.end() && it_other->second->empty())
101 ++it_other;
102 if (it_this == end() || it_other == other.end())
103 break;
104 if (it_this->first != it_other->first ||
105 !it_this->second->Equals(*it_other->second)) {
106 return false;
107 }
108 ++it_this;
109 ++it_other;
110 }
111 return it_this == end() && it_other == other.end();
112 }
113
89 PolicyBundle::const_iterator PolicyBundle::begin() const { 114 PolicyBundle::const_iterator PolicyBundle::begin() const {
90 return policy_bundle_.begin(); 115 return policy_bundle_.begin();
91 } 116 }
92 117
93 PolicyBundle::const_iterator PolicyBundle::end() const { 118 PolicyBundle::const_iterator PolicyBundle::end() const {
94 return policy_bundle_.end(); 119 return policy_bundle_.end();
95 } 120 }
96 121
97 void PolicyBundle::Clear() { 122 void PolicyBundle::Clear() {
98 STLDeleteValues(&policy_bundle_); 123 STLDeleteValues(&policy_bundle_);
99 } 124 }
100 125
101 } // namespace policy 126 } // namespace policy
OLDNEW
« 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