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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 << "' has value " << *shill_value | 241 << "' has value " << *shill_value |
242 << ", but expected a string: " << GetName(); | 242 << ", but expected a string: " << GetName(); |
243 } | 243 } |
244 } | 244 } |
245 } | 245 } |
246 | 246 |
247 void ShillToONCTranslator::TranslateIPsec() { | 247 void ShillToONCTranslator::TranslateIPsec() { |
248 CopyPropertiesAccordingToSignature(); | 248 CopyPropertiesAccordingToSignature(); |
249 if (shill_dictionary_->HasKey(shill::kL2tpIpsecXauthUserProperty)) | 249 if (shill_dictionary_->HasKey(shill::kL2tpIpsecXauthUserProperty)) |
250 TranslateAndAddNestedObject(::onc::ipsec::kXAUTH); | 250 TranslateAndAddNestedObject(::onc::ipsec::kXAUTH); |
| 251 std::string client_cert_id; |
| 252 shill_dictionary_->GetStringWithoutPathExpansion( |
| 253 shill::kL2tpIpsecClientCertIdProperty, &client_cert_id); |
| 254 std::string authentication_type = |
| 255 client_cert_id.empty() ? ::onc::ipsec::kPSK : ::onc::ipsec::kCert; |
| 256 onc_object_->SetStringWithoutPathExpansion(::onc::ipsec::kAuthenticationType, |
| 257 authentication_type); |
251 } | 258 } |
252 | 259 |
253 void ShillToONCTranslator::TranslateVPN() { | 260 void ShillToONCTranslator::TranslateVPN() { |
254 CopyPropertiesAccordingToSignature(); | 261 CopyPropertiesAccordingToSignature(); |
255 | 262 |
256 // Parse Shill Provider dictionary. Note, this may not exist, e.g. if we are | 263 // Parse Shill Provider dictionary. Note, this may not exist, e.g. if we are |
257 // just translating network state in network_util::TranslateNetworkStateToONC. | 264 // just translating network state in network_util::TranslateNetworkStateToONC. |
258 const base::DictionaryValue* provider = NULL; | 265 const base::DictionaryValue* provider = NULL; |
259 if (!shill_dictionary_->GetDictionaryWithoutPathExpansion( | 266 if (!shill_dictionary_->GetDictionaryWithoutPathExpansion( |
260 shill::kProviderProperty, &provider)) { | 267 shill::kProviderProperty, &provider)) { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 const base::DictionaryValue& shill_dictionary, | 621 const base::DictionaryValue& shill_dictionary, |
615 const OncValueSignature* onc_signature) { | 622 const OncValueSignature* onc_signature) { |
616 CHECK(onc_signature != NULL); | 623 CHECK(onc_signature != NULL); |
617 | 624 |
618 ShillToONCTranslator translator(shill_dictionary, *onc_signature); | 625 ShillToONCTranslator translator(shill_dictionary, *onc_signature); |
619 return translator.CreateTranslatedONCObject(); | 626 return translator.CreateTranslatedONCObject(); |
620 } | 627 } |
621 | 628 |
622 } // namespace onc | 629 } // namespace onc |
623 } // namespace chromeos | 630 } // namespace chromeos |
OLD | NEW |