| 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 1daf4a7c301baebfa5553c889a1701be79085dbc..cfce26a3f5ce272033273e9ec667db0804dac24f 100644
|
| --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc
|
| @@ -84,7 +84,7 @@ class ShillToONCTranslator {
|
| void TranslateCellularDevice();
|
| void TranslateNetworkWithState();
|
| void TranslateIPConfig();
|
| - void TranslateSavedOrStaticIPConfig(const std::string& nameserver_property);
|
| + void TranslateSavedOrStaticIPConfig();
|
| void TranslateSavedIPConfig();
|
| void TranslateStaticIPConfig();
|
|
|
| @@ -479,8 +479,19 @@ void ShillToONCTranslator::TranslateNetworkWithState() {
|
| *shill_ipconfigs);
|
| }
|
|
|
| - TranslateAndAddNestedObject(::onc::network_config::kSavedIPConfig);
|
| - TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig);
|
| + const base::DictionaryValue* saved_ipconfig = nullptr;
|
| + if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
|
| + shill::kSavedIPConfigProperty, &saved_ipconfig)) {
|
| + TranslateAndAddNestedObject(::onc::network_config::kSavedIPConfig,
|
| + *saved_ipconfig);
|
| + }
|
| +
|
| + const base::DictionaryValue* static_ipconfig = nullptr;
|
| + if (shill_dictionary_->GetDictionaryWithoutPathExpansion(
|
| + shill::kStaticIPConfigProperty, &static_ipconfig)) {
|
| + TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig,
|
| + *static_ipconfig);
|
| + }
|
| }
|
|
|
| void ShillToONCTranslator::TranslateIPConfig() {
|
| @@ -502,24 +513,9 @@ void ShillToONCTranslator::TranslateIPConfig() {
|
| onc_object_->SetStringWithoutPathExpansion(::onc::ipconfig::kType, type);
|
| }
|
|
|
| -void ShillToONCTranslator::TranslateSavedOrStaticIPConfig(
|
| - const std::string& nameserver_property) {
|
| +void ShillToONCTranslator::TranslateSavedOrStaticIPConfig() {
|
| CopyPropertiesAccordingToSignature();
|
| - // Saved/Static IP config nameservers are stored as a comma separated list.
|
| - std::string shill_nameservers;
|
| - shill_dictionary_->GetStringWithoutPathExpansion(
|
| - nameserver_property, &shill_nameservers);
|
| - std::vector<std::string> onc_nameserver_vector;
|
| - if (Tokenize(shill_nameservers, ",", &onc_nameserver_vector) > 0) {
|
| - scoped_ptr<base::ListValue> onc_nameservers(new base::ListValue);
|
| - for (std::vector<std::string>::iterator iter =
|
| - onc_nameserver_vector.begin();
|
| - iter != onc_nameserver_vector.end(); ++iter) {
|
| - onc_nameservers->AppendString(*iter);
|
| - }
|
| - onc_object_->SetWithoutPathExpansion(::onc::ipconfig::kNameServers,
|
| - onc_nameservers.release());
|
| - }
|
| +
|
| // Static and Saved IPConfig in Shill are always of type IPv4. Set this type
|
| // in ONC, but not if the object would be empty except the type.
|
| if (!onc_object_->empty()) {
|
| @@ -529,11 +525,11 @@ void ShillToONCTranslator::TranslateSavedOrStaticIPConfig(
|
| }
|
|
|
| void ShillToONCTranslator::TranslateSavedIPConfig() {
|
| - TranslateSavedOrStaticIPConfig(shill::kSavedIPNameServersProperty);
|
| + TranslateSavedOrStaticIPConfig();
|
| }
|
|
|
| void ShillToONCTranslator::TranslateStaticIPConfig() {
|
| - TranslateSavedOrStaticIPConfig(shill::kStaticIPNameServersProperty);
|
| + TranslateSavedOrStaticIPConfig();
|
| }
|
|
|
| void ShillToONCTranslator::TranslateAndAddNestedObject(
|
|
|