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

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

Issue 708563005: Use setProperties for IP Config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_430113_internet_options_1
Patch Set: IPConfigType=Static applies to NameServer only config Created 6 years 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: chromeos/network/onc/onc_translator_onc_to_shill.cc
diff --git a/chromeos/network/onc/onc_translator_onc_to_shill.cc b/chromeos/network/onc/onc_translator_onc_to_shill.cc
index c43677aec17495e438f49f7caa1b60411392d3ba..e0e98cf45c2ade98cf6da3cdee2669f1a87ff04d 100644
--- a/chromeos/network/onc/onc_translator_onc_to_shill.cc
+++ b/chromeos/network/onc/onc_translator_onc_to_shill.cc
@@ -198,9 +198,11 @@ void LocalTranslator::TranslateVPN() {
void LocalTranslator::TranslateWiFi() {
std::string security;
- onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
- TranslateWithTableAndSet(security, kWiFiSecurityTable,
- shill::kSecurityProperty);
+ if (onc_object_->GetStringWithoutPathExpansion(
+ ::onc::wifi::kSecurity, &security)) {
+ TranslateWithTableAndSet(security, kWiFiSecurityTable,
+ shill::kSecurityProperty);
+ }
std::string ssid;
onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSSID, &ssid);
@@ -257,22 +259,17 @@ void LocalTranslator::TranslateNetworkConfiguration() {
if (type == ::onc::network_type::kVPN)
CopyFieldFromONCToShill(::onc::network_config::kName, shill::kNameProperty);
+ // If IPConfigType is specified and set to DHCP, ensure that we have an
+ // empty StaticIPConfigs object defined which will clear any existing
pneubeck (no reviews) 2014/12/05 09:47:46 below you set it to Null and not to an empty Dict
stevenjb 2015/01/08 00:44:39 Addressed in other CL.
+ // values.
std::string ipconfig_type;
- onc_object_->GetStringWithoutPathExpansion(
- ::onc::network_config::kIPConfigType, &ipconfig_type);
-
- if (ipconfig_type == ::onc::network_config::kIPConfigTypeDHCP) {
- // Clear the properties of StaticIPConfig.
+ if (onc_object_->GetStringWithoutPathExpansion(
+ ::onc::network_config::kIPConfigType, &ipconfig_type) &&
+ ipconfig_type == ::onc::network_config::kIPConfigTypeDHCP) {
scoped_ptr<base::DictionaryValue> static_ipconfig(
new base::DictionaryValue);
- static_ipconfig->SetWithoutPathExpansion(shill::kAddressProperty,
- base::Value::CreateNullValue());
- static_ipconfig->SetWithoutPathExpansion(shill::kGatewayProperty,
- base::Value::CreateNullValue());
- static_ipconfig->SetWithoutPathExpansion(shill::kPrefixlenProperty,
- base::Value::CreateNullValue());
shill_dictionary_->SetWithoutPathExpansion(shill::kStaticIPConfigProperty,
- static_ipconfig.release());
+ base::Value::CreateNullValue());
}
// Otherwise, the StaticIPConfig is set and translated.
@@ -342,7 +339,7 @@ void LocalTranslator::TranslateWithTableAndSet(
// occurs, we should check here. Otherwise the failure will only show up much
// later in Shill.
LOG(ERROR) << "Value '" << onc_value
- << "' cannot be translated to Shill property "
+ << "' cannot be translated to Shill property: "
<< shill_property_name;
}

Powered by Google App Engine
This is Rietveld 408576698