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

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

Issue 2231753002: components: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more call site Created 4 years, 4 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/registry_dict_win.h" 5 #include "components/policy/core/common/registry_dict_win.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 std::unique_ptr<RegistryDict> result; 177 std::unique_ptr<RegistryDict> result;
178 KeyMap::iterator entry = keys_.find(name); 178 KeyMap::iterator entry = keys_.find(name);
179 if (entry != keys_.end()) { 179 if (entry != keys_.end()) {
180 result.reset(entry->second); 180 result.reset(entry->second);
181 keys_.erase(entry); 181 keys_.erase(entry);
182 } 182 }
183 return result; 183 return result;
184 } 184 }
185 185
186 void RegistryDict::ClearKeys() { 186 void RegistryDict::ClearKeys() {
187 STLDeleteValues(&keys_); 187 base::STLDeleteValues(&keys_);
188 } 188 }
189 189
190 base::Value* RegistryDict::GetValue(const std::string& name) { 190 base::Value* RegistryDict::GetValue(const std::string& name) {
191 ValueMap::iterator entry = values_.find(name); 191 ValueMap::iterator entry = values_.find(name);
192 return entry != values_.end() ? entry->second : NULL; 192 return entry != values_.end() ? entry->second : NULL;
193 } 193 }
194 194
195 const base::Value* RegistryDict::GetValue(const std::string& name) const { 195 const base::Value* RegistryDict::GetValue(const std::string& name) const {
196 ValueMap::const_iterator entry = values_.find(name); 196 ValueMap::const_iterator entry = values_.find(name);
197 return entry != values_.end() ? entry->second : NULL; 197 return entry != values_.end() ? entry->second : NULL;
(...skipping 16 matching lines...) Expand all
214 std::unique_ptr<base::Value> result; 214 std::unique_ptr<base::Value> result;
215 ValueMap::iterator entry = values_.find(name); 215 ValueMap::iterator entry = values_.find(name);
216 if (entry != values_.end()) { 216 if (entry != values_.end()) {
217 result.reset(entry->second); 217 result.reset(entry->second);
218 values_.erase(entry); 218 values_.erase(entry);
219 } 219 }
220 return result; 220 return result;
221 } 221 }
222 222
223 void RegistryDict::ClearValues() { 223 void RegistryDict::ClearValues() {
224 STLDeleteValues(&values_); 224 base::STLDeleteValues(&values_);
225 } 225 }
226 226
227 void RegistryDict::Merge(const RegistryDict& other) { 227 void RegistryDict::Merge(const RegistryDict& other) {
228 for (KeyMap::const_iterator entry(other.keys_.begin()); 228 for (KeyMap::const_iterator entry(other.keys_.begin());
229 entry != other.keys_.end(); ++entry) { 229 entry != other.keys_.end(); ++entry) {
230 RegistryDict*& subdict = keys_[entry->first]; 230 RegistryDict*& subdict = keys_[entry->first];
231 if (!subdict) 231 if (!subdict)
232 subdict = new RegistryDict(); 232 subdict = new RegistryDict();
233 subdict->Merge(*entry->second); 233 subdict->Merge(*entry->second);
234 } 234 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 return std::move(result); 349 return std::move(result);
350 } 350 }
351 default: 351 default:
352 LOG(WARNING) << "Can't convert registry key to schema type " << type; 352 LOG(WARNING) << "Can't convert registry key to schema type " << type;
353 } 353 }
354 354
355 return nullptr; 355 return nullptr;
356 } 356 }
357 357
358 } // namespace policy 358 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_service_impl.cc ('k') | components/policy/core/common/schema.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698