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

Side by Side Diff: chromeos/network/onc/onc_translator_onc_to_shill.cc

Issue 694533007: Add 'setProperties' to InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + feedback Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chromeos/network/network_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The implementation of TranslateONCObjectToShill is structured in two parts: 5 // The implementation of TranslateONCObjectToShill is structured in two parts:
6 // - The recursion through the existing ONC hierarchy 6 // - The recursion through the existing ONC hierarchy
7 // see TranslateONCHierarchy 7 // see TranslateONCHierarchy
8 // - The local translation of an object depending on the associated signature 8 // - The local translation of an object depending on the associated signature
9 // see LocalTranslator::TranslateFields 9 // see LocalTranslator::TranslateFields
10 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 // SaveCredentials needs special handling when translating from Shill -> ONC 212 // SaveCredentials needs special handling when translating from Shill -> ONC
213 // so handle it explicitly here. 213 // so handle it explicitly here.
214 CopyFieldFromONCToShill(::onc::vpn::kSaveCredentials, 214 CopyFieldFromONCToShill(::onc::vpn::kSaveCredentials,
215 shill::kSaveCredentialsProperty); 215 shill::kSaveCredentialsProperty);
216 } 216 }
217 217
218 void LocalTranslator::TranslateVPN() { 218 void LocalTranslator::TranslateVPN() {
219 CopyFieldFromONCToShill(::onc::vpn::kHost, shill::kProviderHostProperty); 219 CopyFieldFromONCToShill(::onc::vpn::kHost, shill::kProviderHostProperty);
220 std::string type; 220 std::string type;
221 onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &type); 221 if (onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &type))
222 TranslateWithTableAndSet(type, kVPNTypeTable, shill::kProviderTypeProperty); 222 TranslateWithTableAndSet(type, kVPNTypeTable, shill::kProviderTypeProperty);
223 223
224 CopyFieldsAccordingToSignature(); 224 CopyFieldsAccordingToSignature();
225 } 225 }
226 226
227 void LocalTranslator::TranslateWiFi() { 227 void LocalTranslator::TranslateWiFi() {
228 std::string security; 228 std::string security;
229 onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security); 229 onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
230 TranslateWithTableAndSet(security, kWiFiSecurityTable, 230 TranslateWithTableAndSet(security, kWiFiSecurityTable,
231 shill::kSecurityProperty); 231 shill::kSecurityProperty);
232 232
233 std::string ssid; 233 std::string ssid;
234 onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSSID, &ssid); 234 onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSSID, &ssid);
235 shill_property_util::SetSSID(ssid, shill_dictionary_); 235 if (!ssid.empty())
236 shill_property_util::SetSSID(ssid, shill_dictionary_);
236 237
237 // We currently only support managed and no adhoc networks. 238 // We currently only support managed and no adhoc networks.
238 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty, 239 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty,
239 shill::kModeManaged); 240 shill::kModeManaged);
240 241
241 bool allow_gateway_arp_polling; 242 bool allow_gateway_arp_polling;
242 if (onc_object_->GetBooleanWithoutPathExpansion( 243 if (onc_object_->GetBooleanWithoutPathExpansion(
243 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) { 244 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) {
244 shill_dictionary_->SetBooleanWithoutPathExpansion( 245 shill_dictionary_->SetBooleanWithoutPathExpansion(
245 shill::kLinkMonitorDisableProperty, !allow_gateway_arp_polling); 246 shill::kLinkMonitorDisableProperty, !allow_gateway_arp_polling);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 const OncValueSignature* onc_signature, 402 const OncValueSignature* onc_signature,
402 const base::DictionaryValue& onc_object) { 403 const base::DictionaryValue& onc_object) {
403 CHECK(onc_signature != NULL); 404 CHECK(onc_signature != NULL);
404 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 405 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
405 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 406 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
406 return shill_dictionary.Pass(); 407 return shill_dictionary.Pass();
407 } 408 }
408 409
409 } // namespace onc 410 } // namespace onc
410 } // namespace chromeos 411 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698