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

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

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 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
Index: components/policy/core/common/policy_loader_win.cc
diff --git a/components/policy/core/common/policy_loader_win.cc b/components/policy/core/common/policy_loader_win.cc
index d739a038a030658d6779f0d55432bde312925cf1..925a826fc6cbfe54fceea670e1c3e64b79a8c9e8 100644
--- a/components/policy/core/common/policy_loader_win.cc
+++ b/components/policy/core/common/policy_loader_win.cc
@@ -148,10 +148,9 @@ void FilterUntrustedPolicy(PolicyMap* policy) {
return;
std::unique_ptr<base::ListValue> filtered_values(new base::ListValue);
- for (base::ListValue::const_iterator list_entry(policy_list_value->begin());
- list_entry != policy_list_value->end(); ++list_entry) {
+ for (const auto& list_entry : *policy_list_value) {
std::string entry;
- if (!(*list_entry)->GetAsString(&entry))
+ if (!list_entry->GetAsString(&entry))
continue;
size_t pos = entry.find(';');
if (pos == std::string::npos)
@@ -166,10 +165,9 @@ void FilterUntrustedPolicy(PolicyMap* policy) {
filtered_values->AppendString(entry);
}
if (invalid_policies) {
- policy->Set(key::kExtensionInstallForcelist,
- map_entry->level, map_entry->scope, map_entry->source,
- filtered_values.release(),
- map_entry->external_data_fetcher);
+ PolicyMap::Entry filtered_entry = map_entry->DeepCopy();
+ filtered_entry.value = std::move(filtered_values);
+ policy->Set(key::kExtensionInstallForcelist, std::move(filtered_entry));
const PolicyDetails* details = GetChromePolicyDetails(
key::kExtensionInstallForcelist);

Powered by Google App Engine
This is Rietveld 408576698