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

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

Issue 2891453002: Introduce networkingPrivate.getCertificateLists (Closed)
Patch Set: Clang format Created 3 years, 6 months 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
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 13
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/json/json_writer.h" 15 #include "base/json/json_writer.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "chromeos/network/client_cert_util.h"
21 #include "chromeos/network/onc/onc_signature.h" 22 #include "chromeos/network/onc/onc_signature.h"
22 #include "chromeos/network/onc/onc_translation_tables.h" 23 #include "chromeos/network/onc/onc_translation_tables.h"
23 #include "chromeos/network/onc/onc_translator.h" 24 #include "chromeos/network/onc/onc_translator.h"
24 #include "chromeos/network/onc/onc_utils.h" 25 #include "chromeos/network/onc/onc_utils.h"
25 #include "chromeos/network/shill_property_util.h" 26 #include "chromeos/network/shill_property_util.h"
26 #include "components/onc/onc_constants.h" 27 #include "components/onc/onc_constants.h"
27 #include "third_party/cros_system_api/dbus/service_constants.h" 28 #include "third_party/cros_system_api/dbus/service_constants.h"
28 29
29 namespace chromeos { 30 namespace chromeos {
30 namespace onc { 31 namespace onc {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Shill. 256 // Shill.
256 onc_object_->GetStringWithoutPathExpansion(::onc::eap::kInner, &inner); 257 onc_object_->GetStringWithoutPathExpansion(::onc::eap::kInner, &inner);
257 if (inner != ::onc::eap::kAutomatic) { 258 if (inner != ::onc::eap::kAutomatic) {
258 const StringTranslationEntry* table = outer == ::onc::eap::kPEAP 259 const StringTranslationEntry* table = outer == ::onc::eap::kPEAP
259 ? kEAP_PEAP_InnerTable 260 ? kEAP_PEAP_InnerTable
260 : kEAP_TTLS_InnerTable; 261 : kEAP_TTLS_InnerTable;
261 TranslateWithTableAndSet(inner, table, shill::kEapPhase2AuthProperty); 262 TranslateWithTableAndSet(inner, table, shill::kEapPhase2AuthProperty);
262 } 263 }
263 } 264 }
264 265
266 std::string cert_type;
267 onc_object_->GetStringWithoutPathExpansion(
268 ::onc::client_cert::kClientCertType, &cert_type);
269 if (cert_type == ::onc::client_cert::kPKCS11Id) {
270 std::string pkcs11_id;
271 onc_object_->GetStringWithoutPathExpansion(
272 ::onc::client_cert::kClientCertPKCS11Id, &pkcs11_id);
273 shill_dictionary_->SetStringWithoutPathExpansion(
274 shill::kEapPinProperty, chromeos::client_cert::kDefaultTPMPin);
275 shill_dictionary_->SetStringWithoutPathExpansion(shill::kEapCertIdProperty,
276 pkcs11_id);
277 shill_dictionary_->SetStringWithoutPathExpansion(shill::kEapKeyIdProperty,
278 pkcs11_id);
279 }
280
265 CopyFieldsAccordingToSignature(); 281 CopyFieldsAccordingToSignature();
266 } 282 }
267 283
268 void LocalTranslator::TranslateNetworkConfiguration() { 284 void LocalTranslator::TranslateNetworkConfiguration() {
269 std::string type; 285 std::string type;
270 onc_object_->GetStringWithoutPathExpansion(::onc::network_config::kType, 286 onc_object_->GetStringWithoutPathExpansion(::onc::network_config::kType,
271 &type); 287 &type);
272 288
273 // Set the type except for Ethernet which is set in TranslateEthernet. 289 // Set the type except for Ethernet which is set in TranslateEthernet.
274 if (type != ::onc::network_type::kEthernet) 290 if (type != ::onc::network_type::kEthernet)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 const base::DictionaryValue& onc_object) { 438 const base::DictionaryValue& onc_object) {
423 CHECK(onc_signature != NULL); 439 CHECK(onc_signature != NULL);
424 std::unique_ptr<base::DictionaryValue> shill_dictionary( 440 std::unique_ptr<base::DictionaryValue> shill_dictionary(
425 new base::DictionaryValue); 441 new base::DictionaryValue);
426 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get()); 442 TranslateONCHierarchy(*onc_signature, onc_object, shill_dictionary.get());
427 return shill_dictionary; 443 return shill_dictionary;
428 } 444 }
429 445
430 } // namespace onc 446 } // namespace onc
431 } // namespace chromeos 447 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_translation_tables.cc ('k') | chromeos/network/onc/onc_translator_shill_to_onc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698