Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 void LocalTranslator::TranslateIPsec() { | 181 void LocalTranslator::TranslateIPsec() { |
| 182 CopyFieldsAccordingToSignature(); | 182 CopyFieldsAccordingToSignature(); |
| 183 | 183 |
| 184 // SaveCredentials needs special handling when translating from Shill -> ONC | 184 // SaveCredentials needs special handling when translating from Shill -> ONC |
| 185 // so handle it explicitly here. | 185 // so handle it explicitly here. |
| 186 CopyFieldFromONCToShill(::onc::vpn::kSaveCredentials, | 186 CopyFieldFromONCToShill(::onc::vpn::kSaveCredentials, |
| 187 shill::kSaveCredentialsProperty); | 187 shill::kSaveCredentialsProperty); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void LocalTranslator::TranslateVPN() { | 190 void LocalTranslator::TranslateVPN() { |
| 191 CopyFieldFromONCToShill(::onc::vpn::kHost, shill::kProviderHostProperty); | 191 std::string onc_type; |
| 192 std::string type; | 192 if (onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &onc_type)) |
|
pneubeck (no reviews)
2015/03/18 19:35:29
nit: missing {}
bartfab (slow)
2015/03/18 20:02:14
Done.
| |
| 193 if (onc_object_->GetStringWithoutPathExpansion(::onc::vpn::kType, &type)) | 193 TranslateWithTableAndSet(onc_type, kVPNTypeTable, |
| 194 TranslateWithTableAndSet(type, kVPNTypeTable, shill::kProviderTypeProperty); | 194 shill::kProviderTypeProperty); |
| 195 if (onc_type == ::onc::vpn::kThirdPartyVpn) { | |
| 196 // For third-party VPNs, |shill::kProviderHostProperty| is used to store the | |
| 197 // provider's extension ID. | |
| 198 const base::DictionaryValue* onc_third_party_vpn = nullptr; | |
| 199 onc_object_->GetDictionaryWithoutPathExpansion(::onc::vpn::kThirdPartyVpn, | |
| 200 &onc_third_party_vpn); | |
| 201 std::string onc_extension_id; | |
| 202 if (onc_third_party_vpn && | |
| 203 onc_third_party_vpn->GetStringWithoutPathExpansion( | |
| 204 ::onc::third_party_vpn::kExtensionID, &onc_extension_id)) { | |
| 205 shill_dictionary_->SetStringWithoutPathExpansion( | |
| 206 shill::kProviderHostProperty, onc_extension_id); | |
| 207 } | |
| 208 } else { | |
| 209 CopyFieldFromONCToShill(::onc::vpn::kHost, shill::kProviderHostProperty); | |
| 210 } | |
| 195 | 211 |
| 196 CopyFieldsAccordingToSignature(); | 212 CopyFieldsAccordingToSignature(); |
| 197 } | 213 } |
| 198 | 214 |
| 199 void LocalTranslator::TranslateWiFi() { | 215 void LocalTranslator::TranslateWiFi() { |
| 200 std::string security; | 216 std::string security; |
| 201 if (onc_object_->GetStringWithoutPathExpansion( | 217 if (onc_object_->GetStringWithoutPathExpansion( |
| 202 ::onc::wifi::kSecurity, &security)) { | 218 ::onc::wifi::kSecurity, &security)) { |
| 203 TranslateWithTableAndSet(security, kWiFiSecurityTable, | 219 TranslateWithTableAndSet(security, kWiFiSecurityTable, |
| 204 shill::kSecurityClassProperty); | 220 shill::kSecurityClassProperty); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 const OncValueSignature* onc_signature, | 401 const OncValueSignature* onc_signature, |
| 386 const base::DictionaryValue& onc_object) { | 402 const base::DictionaryValue& onc_object) { |
| 387 CHECK(onc_signature != NULL); | 403 CHECK(onc_signature != NULL); |
| 388 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); | 404 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); |
| 389 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); | 405 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); |
| 390 return shill_dictionary.Pass(); | 406 return shill_dictionary.Pass(); |
| 391 } | 407 } |
| 392 | 408 |
| 393 } // namespace onc | 409 } // namespace onc |
| 394 } // namespace chromeos | 410 } // namespace chromeos |
| OLD | NEW |