| 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 #include "chromeos/network/onc/onc_translator.h" | 5 #include "chromeos/network/onc/onc_translator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 << "' has value " << *shill_value | 233 << "' has value " << *shill_value |
| 234 << ", but expected a string: " << GetName(); | 234 << ", but expected a string: " << GetName(); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void ShillToONCTranslator::TranslateIPsec() { | 239 void ShillToONCTranslator::TranslateIPsec() { |
| 240 CopyPropertiesAccordingToSignature(); | 240 CopyPropertiesAccordingToSignature(); |
| 241 if (shill_dictionary_->HasKey(shill::kL2tpIpsecXauthUserProperty)) | 241 if (shill_dictionary_->HasKey(shill::kL2tpIpsecXauthUserProperty)) |
| 242 TranslateAndAddNestedObject(::onc::ipsec::kXAUTH); | 242 TranslateAndAddNestedObject(::onc::ipsec::kXAUTH); |
| 243 std::string client_cert_id; |
| 244 shill_dictionary_->GetStringWithoutPathExpansion( |
| 245 shill::kL2tpIpsecClientCertIdProperty, &client_cert_id); |
| 246 std::string authentication_type = |
| 247 client_cert_id.empty() ? ::onc::ipsec::kPSK : ::onc::ipsec::kCert; |
| 248 onc_object_->SetStringWithoutPathExpansion(::onc::ipsec::kAuthenticationType, |
| 249 authentication_type); |
| 243 } | 250 } |
| 244 | 251 |
| 245 void ShillToONCTranslator::TranslateVPN() { | 252 void ShillToONCTranslator::TranslateVPN() { |
| 246 CopyPropertiesAccordingToSignature(); | 253 CopyPropertiesAccordingToSignature(); |
| 247 | 254 |
| 248 // Parse Shill Provider dictionary. Note, this may not exist, e.g. if we are | 255 // Parse Shill Provider dictionary. Note, this may not exist, e.g. if we are |
| 249 // just translating network state in network_util::TranslateNetworkStateToONC. | 256 // just translating network state in network_util::TranslateNetworkStateToONC. |
| 250 const base::DictionaryValue* provider = NULL; | 257 const base::DictionaryValue* provider = NULL; |
| 251 if (!shill_dictionary_->GetDictionaryWithoutPathExpansion( | 258 if (!shill_dictionary_->GetDictionaryWithoutPathExpansion( |
| 252 shill::kProviderProperty, &provider)) { | 259 shill::kProviderProperty, &provider)) { |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 const base::DictionaryValue& shill_dictionary, | 581 const base::DictionaryValue& shill_dictionary, |
| 575 const OncValueSignature* onc_signature) { | 582 const OncValueSignature* onc_signature) { |
| 576 CHECK(onc_signature != NULL); | 583 CHECK(onc_signature != NULL); |
| 577 | 584 |
| 578 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 585 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
| 579 return translator.CreateTranslatedONCObject(); | 586 return translator.CreateTranslatedONCObject(); |
| 580 } | 587 } |
| 581 | 588 |
| 582 } // namespace onc | 589 } // namespace onc |
| 583 } // namespace chromeos | 590 } // namespace chromeos |
| OLD | NEW |