Chromium Code Reviews| 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 cfce26a3f5ce272033273e9ec667db0804dac24f..fccd4076f1551c78606a3f77127a86a61231877c 100644 |
| --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc |
| +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc |
| @@ -486,11 +486,30 @@ void ShillToONCTranslator::TranslateNetworkWithState() { |
| *saved_ipconfig); |
| } |
| + // Translate the StaticIPConfig object and set the IP config types. |
| const base::DictionaryValue* static_ipconfig = nullptr; |
| if (shill_dictionary_->GetDictionaryWithoutPathExpansion( |
| - shill::kStaticIPConfigProperty, &static_ipconfig)) { |
| - TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig, |
| - *static_ipconfig); |
| + shill::kStaticIPConfigProperty, &static_ipconfig)) { |
| + std::string ip_address; |
| + if (static_ipconfig->GetStringWithoutPathExpansion(shill::kAddressProperty, |
| + &ip_address) && |
| + !ip_address.empty()) { |
| + onc_object_->SetStringWithoutPathExpansion( |
| + ::onc::network_config::kIPAddressConfigType, |
| + ::onc::network_config::kIPConfigTypeStatic); |
| + } |
| + const base::ListValue* name_servers; |
|
pneubeck (no reviews)
2015/01/04 11:18:01
please add the default nullptr-initialization.
stevenjb
2015/01/05 21:16:19
Done.
|
| + if (static_ipconfig->GetListWithoutPathExpansion( |
| + shill::kNameServersProperty, &name_servers) && |
| + !name_servers->empty()) { |
| + onc_object_->SetStringWithoutPathExpansion( |
| + ::onc::network_config::kNameServersConfigType, |
| + ::onc::network_config::kIPConfigTypeStatic); |
| + } |
| + if (!ip_address.empty() || !name_servers->empty()) { |
| + TranslateAndAddNestedObject(::onc::network_config::kStaticIPConfig, |
| + *static_ipconfig); |
| + } |
| } |
| } |