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

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

Issue 1412283006: Translate 802.1x WEP ("Enterprise WEP") (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using local namespace to supply "IEEE8021X" value Created 5 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
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 11 matching lines...) Expand all
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 const char kKeyManagementIEEE8021X[] = "IEEE8021X";
stevenjb 2015/11/04 18:36:00 nit: Add a TODO here to use the value in service_c
33
32 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) { 34 scoped_ptr<base::StringValue> ConvertValueToString(const base::Value& value) {
33 std::string str; 35 std::string str;
34 if (!value.GetAsString(&str)) 36 if (!value.GetAsString(&str))
35 base::JSONWriter::Write(value, &str); 37 base::JSONWriter::Write(value, &str);
36 return make_scoped_ptr(new base::StringValue(str)); 38 return make_scoped_ptr(new base::StringValue(str));
37 } 39 }
38 40
39 // This class is responsible to translate the local fields of the given 41 // This class is responsible to translate the local fields of the given
40 // |onc_object| according to |onc_signature| into |shill_dictionary|. This 42 // |onc_object| according to |onc_signature| into |shill_dictionary|. This
41 // translation should consider (if possible) only fields of this ONC object and 43 // translation should consider (if possible) only fields of this ONC object and
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 215
214 CopyFieldsAccordingToSignature(); 216 CopyFieldsAccordingToSignature();
215 } 217 }
216 218
217 void LocalTranslator::TranslateWiFi() { 219 void LocalTranslator::TranslateWiFi() {
218 std::string security; 220 std::string security;
219 if (onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, 221 if (onc_object_->GetStringWithoutPathExpansion(::onc::wifi::kSecurity,
220 &security)) { 222 &security)) {
221 TranslateWithTableAndSet(security, kWiFiSecurityTable, 223 TranslateWithTableAndSet(security, kWiFiSecurityTable,
222 shill::kSecurityClassProperty); 224 shill::kSecurityClassProperty);
225 if (security == ::onc::wifi::kWEP_8021X) {
226 shill_dictionary_->SetStringWithoutPathExpansion(
227 shill::kEapKeyMgmtProperty, kKeyManagementIEEE8021X);
228 }
223 } 229 }
224 230
225 // We currently only support managed and no adhoc networks. 231 // We currently only support managed and no adhoc networks.
226 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty, 232 shill_dictionary_->SetStringWithoutPathExpansion(shill::kModeProperty,
227 shill::kModeManaged); 233 shill::kModeManaged);
228 234
229 bool allow_gateway_arp_polling; 235 bool allow_gateway_arp_polling;
230 if (onc_object_->GetBooleanWithoutPathExpansion( 236 if (onc_object_->GetBooleanWithoutPathExpansion(
231 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) { 237 ::onc::wifi::kAllowGatewayARPPolling, &allow_gateway_arp_polling)) {
232 shill_dictionary_->SetBooleanWithoutPathExpansion( 238 shill_dictionary_->SetBooleanWithoutPathExpansion(
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 const OncValueSignature* onc_signature, 420 const OncValueSignature* onc_signature,
415 const base::DictionaryValue& onc_object) { 421 const base::DictionaryValue& onc_object) {
416 CHECK(onc_signature != NULL); 422 CHECK(onc_signature != NULL);
417 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue); 423 scoped_ptr<base::DictionaryValue> shill_dictionary(new base::DictionaryValue);
418 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 424 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
419 return shill_dictionary.Pass(); 425 return shill_dictionary.Pass();
420 } 426 }
421 427
422 } // namespace onc 428 } // namespace onc
423 } // namespace chromeos 429 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698