| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/certificate_handler.h" | 5 #include "chromeos/network/certificate_handler.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chromeos/network/onc/onc_certificate_importer.h" | 8 #include "chromeos/network/onc/onc_certificate_importer.h" |
| 9 #include "chromeos/network/onc/onc_utils.h" | 9 #include "chromeos/network/onc/onc_utils.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 CertificateHandler::CertificateHandler() { | 13 CertificateHandler::CertificateHandler() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 CertificateHandler::~CertificateHandler() { | 16 CertificateHandler::~CertificateHandler() { |
| 17 } | 17 } |
| 18 | 18 |
| 19 bool CertificateHandler::ImportCertificates( | 19 bool CertificateHandler::ImportCertificates( |
| 20 const base::ListValue& certificates, | 20 const base::ListValue& certificates, |
| 21 onc::ONCSource source, | 21 onc::ONCSource source, |
| 22 net::CertificateList* onc_trusted_certificates) { | 22 net::CertificateList* onc_trusted_certificates, |
| 23 CertsByGUID* imported_server_and_ca_certs) { |
| 23 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates"; | 24 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates"; |
| 24 | 25 |
| 25 // Web trust is only granted to certificates imported by the user. | 26 // Web trust is only granted to certificates imported by the user. |
| 26 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT; | 27 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT; |
| 27 onc::CertificateImporter cert_importer(allow_trust_imports); | 28 onc::CertificateImporter cert_importer(allow_trust_imports); |
| 28 if (cert_importer.ParseAndStoreCertificates( | 29 if (cert_importer.ParseAndStoreCertificates( |
| 29 certificates, onc_trusted_certificates) != | 30 certificates, onc_trusted_certificates, |
| 31 imported_server_and_ca_certs) != |
| 30 onc::CertificateImporter::IMPORT_OK) { | 32 onc::CertificateImporter::IMPORT_OK) { |
| 31 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from " | 33 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from " |
| 32 << onc::GetSourceAsString(source); | 34 << onc::GetSourceAsString(source); |
| 33 return false; | 35 return false; |
| 34 } | 36 } |
| 35 return true; | 37 return true; |
| 36 } | 38 } |
| 37 | 39 |
| 38 } // namespace chromeos | 40 } // namespace chromeos |
| OLD | NEW |