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 11 matching lines...) Expand all Loading... |
22 #include "chromeos/network/onc/onc_utils.h" | 22 #include "chromeos/network/onc/onc_utils.h" |
23 #include "chromeos/network/shill_property_util.h" | 23 #include "chromeos/network/shill_property_util.h" |
24 #include "components/onc/onc_constants.h" | 24 #include "components/onc/onc_constants.h" |
25 #include "third_party/cros_system_api/dbus/service_constants.h" | 25 #include "third_party/cros_system_api/dbus/service_constants.h" |
26 | 26 |
27 namespace chromeos { | 27 namespace chromeos { |
28 namespace onc { | 28 namespace onc { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
| 32 // TODO(pstew): Remove once crosreview.com/310644 lands and merges to Chrome. |
| 33 const char kKeyManagementIEEE8021X[] = "IEEE8021X"; |
| 34 |
32 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) { | 35 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) { |
33 std::string str; | 36 std::string str; |
34 if (!value.GetAsString(&str)) | 37 if (!value.GetAsString(&str)) |
35 base::JSONWriter::Write(value, &str); | 38 base::JSONWriter::Write(value, &str); |
36 return make_scoped_ptr(new base::StringValue(str)); | 39 return make_scoped_ptr(new base::StringValue(str)); |
37 } | 40 } |
38 | 41 |
39 // This class is responsible to translate the local fields of the given | 42 // This class is responsible to translate the local fields of the given |
40 // |onc_object| according to |onc_signature| into |shill_dictionary|. This | 43 // |onc_object| according to |onc_signature| into |shill_dictionary|. This |
41 // translation should consider (if possible) only fields of this ONC object and | 44 // translation should consider (if possible) only fields of this ONC object and |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 216 |
214 CopyFieldsAccordingToSignature(); | 217 CopyFieldsAccordingToSignature(); |
215 } | 218 } |
216 | 219 |
217 void LocalTranslator::TranslateWiFi() { | 220 void LocalTranslator::TranslateWiFi() { |
218 std::string security; | 221 std::string security; |
219 if (onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, | 222 if (onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, |
220 &security)) { | 223 &security)) { |
221 TranslateWithTableAndSet(security, kWiFiSecurityTable, | 224 TranslateWithTableAndSet(security, kWiFiSecurityTable, |
222 shill::kSecurityClassProperty); | 225 shill::kSecurityClassProperty); |
| 226 if (security == ::onc::wifi::kWEP_8021X) { |
| 227 shill_dictionary_->SetStringWithoutPathExpansion( |
| 228 shill::kEapKeyMgmtProperty, kKeyManagementIEEE8021X); |
| 229 } |
223 } | 230 } |
224 | 231 |
225 // We currently only support managed and no adhoc networks. | 232 // We currently only support managed and no adhoc networks. |
226 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty, | 233 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty, |
227 shill::kModeManaged); | 234 shill::kModeManaged); |
228 | 235 |
229 bool allow_gateway_arp_polling; | 236 bool allow_gateway_arp_polling; |
230 if (onc_object_->GetBooleanWithoutPathExpansion( | 237 if (onc_object_->GetBooleanWithoutPathExpansion( |
231 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) { | 238 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) { |
232 shill_dictionary_->SetBooleanWithoutPathExpansion( | 239 shill_dictionary_->SetBooleanWithoutPathExpansion( |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 const OncValueSignature* onc_signature, | 421 const OncValueSignature* onc_signature, |
415 const base::DictionaryValue& onc_object) { | 422 const base::DictionaryValue& onc_object) { |
416 CHECK(onc_signature != NULL); | 423 CHECK(onc_signature != NULL); |
417 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); | 424 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); |
418 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); | 425 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); |
419 return shill_dictionary.Pass(); | 426 return shill_dictionary.Pass(); |
420 } | 427 } |
421 | 428 |
422 } // namespace onc | 429 } // namespace onc |
423 } // namespace chromeos | 430 } // namespace chromeos |
OLD | NEW |