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

Unified Diff: chromeos/network/onc/onc_translator_shill_to_onc.cc

Issue 2884933002: Remove raw base::DictionaryValue::SetWithoutPathExpansion (Closed)
Patch Set: Include Created 3 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 | « base/values.cc ('k') | components/policy/core/common/policy_test_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_translator_shill_to_onc.cc
diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc
index 297822b6b676b5de4bc71d465d6f8aba08ac8996..264df7189db1b1e4336c071094d3cf4a30667339 100644
--- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
+++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
@@ -9,6 +9,7 @@
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "chromeos/network/network_profile_handler.h"
@@ -212,7 +213,7 @@ void ShillToONCTranslator::TranslateOpenVPN() {
std::unique_ptr<base::ListValue> certKUs(new base::ListValue);
certKUs->AppendString(certKU);
onc_object_->SetWithoutPathExpansion(::onc::openvpn::kRemoteCertKU,
- certKUs.release());
+ std::move(certKUs));
}
for (const OncFieldSignature* field_signature = onc_signature_->fields;
@@ -250,7 +251,7 @@ void ShillToONCTranslator::TranslateOpenVPN() {
<< GetName();
} else {
onc_object_->SetWithoutPathExpansion(onc_field_name,
- translated.release());
+ std::move(translated));
}
} else {
LOG(ERROR) << "Shill property '" << shill_property_name << "' has value "
@@ -589,7 +590,7 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
ConvertProxyConfigToOncProxySettings(std::move(proxy_config_value));
if (proxy_settings) {
onc_object_->SetWithoutPathExpansion(
- ::onc::network_config::kProxySettings, proxy_settings.release());
+ ::onc::network_config::kProxySettings, std::move(proxy_settings));
}
}
}
@@ -669,20 +670,22 @@ void ShillToONCTranslator::TranslateAndAddNestedObject(
nested_translator.CreateTranslatedONCObject();
if (nested_object->empty())
return;
- onc_object_->SetWithoutPathExpansion(onc_field_name, nested_object.release());
+ onc_object_->SetWithoutPathExpansion(onc_field_name,
+ std::move(nested_object));
}
void ShillToONCTranslator::SetNestedOncValue(
const std::string& onc_dictionary_name,
const std::string& onc_field_name,
const base::Value& value) {
- base::DictionaryValue* nested;
+ base::DictionaryValue* nested = nullptr;
if (!onc_object_->GetDictionaryWithoutPathExpansion(onc_dictionary_name,
&nested)) {
- nested = new base::DictionaryValue;
- onc_object_->SetWithoutPathExpansion(onc_dictionary_name, nested);
+ nested = onc_object_->SetDictionaryWithoutPathExpansion(
+ onc_dictionary_name, base::MakeUnique<base::DictionaryValue>());
}
- nested->SetWithoutPathExpansion(onc_field_name, value.DeepCopy());
+ nested->SetWithoutPathExpansion(onc_field_name,
+ base::MakeUnique<base::Value>(value));
}
void ShillToONCTranslator::TranslateAndAddListOfObjects(
@@ -717,7 +720,7 @@ void ShillToONCTranslator::TranslateAndAddListOfObjects(
// If there are no entries in the list, there is no need to expose this field.
if (result->empty())
return;
- onc_object_->SetWithoutPathExpansion(onc_field_name, result.release());
+ onc_object_->SetWithoutPathExpansion(onc_field_name, std::move(result));
}
void ShillToONCTranslator::CopyPropertiesAccordingToSignature() {
@@ -758,8 +761,9 @@ void ShillToONCTranslator::CopyProperty(
return;
}
- onc_object_->SetWithoutPathExpansion(field_signature->onc_field_name,
- shill_value->DeepCopy());
+ onc_object_->SetWithoutPathExpansion(
+ field_signature->onc_field_name,
+ base::MakeUnique<base::Value>(*shill_value));
}
void ShillToONCTranslator::TranslateWithTableAndSet(
« no previous file with comments | « base/values.cc ('k') | components/policy/core/common/policy_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698