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

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

Issue 14192017: Extract certificate policy application from NetworkLibrary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 8 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
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/values.h"
8 #include "chromeos/network/onc/onc_certificate_importer.h"
9 #include "chromeos/network/onc/onc_utils.h"
10
11 namespace chromeos {
12
13 CertificateHandler::CertificateHandler() {
14 }
15
16 CertificateHandler::~CertificateHandler() {
17 }
18
19 bool CertificateHandler::ImportCertificates(
20 const base::ListValue& certificates,
21 onc::ONCSource source,
22 net::CertificateList* onc_trusted_certificates) {
23 VLOG(2) << "ONC file has " << certificates.GetSize() << " certificates";
24
25 // Web trust is only granted to certificates imported by the user.
26 bool allow_trust_imports = source == onc::ONC_SOURCE_USER_IMPORT;
27 onc::CertificateImporter cert_importer(allow_trust_imports);
28 if (cert_importer.ParseAndStoreCertificates(
29 certificates, onc_trusted_certificates) !=
30 onc::CertificateImporter::IMPORT_OK) {
31 LOG(ERROR) << "Cannot parse some of the certificates in the ONC from "
32 << onc::GetSourceAsString(source);
33 return false;
34 }
35 return true;
36 }
37
38 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/certificate_handler.h ('k') | chromeos/network/managed_network_configuration_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698