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

Side by Side Diff: chromeos/network/certificate_handler.cc

Issue 20041002: Make CertificateHandler a proper interface of CertificateImporter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chromeos/network/certificate_handler.h ('k') | chromeos/network/mock_certificate_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chromeos/network/certificate_handler.h"
6
7 #include "base/logging.h"
8 #include "base/values.h"
9 #include "chromeos/network/onc/onc_certificate_importer.h"
10 #include "chromeos/network/onc/onc_utils.h"
11
12 namespace chromeos {
13
14 CertificateHandler::CertificateHandler() {
15 }
16
17 CertificateHandler::~CertificateHandler() {
18 }
19
20 bool CertificateHandler::ImportCertificates(
21 const base::ListValue& certificates,
22 onc::ONCSource source,
23 net::CertificateList* onc_trusted_certificates) {
24 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates";
25
26 // Web trust is only granted to certificates imported by the user.
27 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT;
28 onc::CertificateImporter cert_importer(allow_trust_imports);
29 if (cert_importer.ParseAndStoreCertificates(
30 certificates, onc_trusted_certificates, NULL) !=
31 onc::CertificateImporter::IMPORT_OK) {
32 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from "
33 << onc::GetSourceAsString(source);
34 return false;
35 }
36 return true;
37 }
38
39 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/certificate_handler.h ('k') | chromeos/network/mock_certificate_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698