OLD | NEW |
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 #include "net/cert/cert_database.h" | 5 #include "net/cert/cert_database.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
9 #include <secmod.h> | 9 #include <secmod.h> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/observer_list_threadsafe.h" | 12 #include "base/observer_list_threadsafe.h" |
13 #include "crypto/nss_util.h" | 13 #include "crypto/nss_util.h" |
14 #include "crypto/scoped_nss_types.h" | 14 #include "crypto/scoped_nss_types.h" |
15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
16 #include "net/cert/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
17 #include "net/cert/x509_util_nss.h" | 17 #include "net/cert/x509_util_nss.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 CertDatabase::CertDatabase() | 21 CertDatabase::CertDatabase() |
22 : observer_list_(new ObserverListThreadSafe<Observer>) { | 22 : observer_list_(new base::ObserverListThreadSafe<Observer>) { |
23 crypto::EnsureNSSInit(); | 23 crypto::EnsureNSSInit(); |
24 } | 24 } |
25 | 25 |
26 CertDatabase::~CertDatabase() {} | 26 CertDatabase::~CertDatabase() {} |
27 | 27 |
28 int CertDatabase::CheckUserCert(X509Certificate* cert_obj) { | 28 int CertDatabase::CheckUserCert(X509Certificate* cert_obj) { |
29 if (!cert_obj) | 29 if (!cert_obj) |
30 return ERR_CERT_INVALID; | 30 return ERR_CERT_INVALID; |
31 if (cert_obj->HasExpired()) | 31 if (cert_obj->HasExpired()) |
32 return ERR_CERT_DATE_INVALID; | 32 return ERR_CERT_DATE_INVALID; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 if (rv != SECSuccess) { | 69 if (rv != SECSuccess) { |
70 LOG(ERROR) << "Couldn't import user certificate. " << PORT_GetError(); | 70 LOG(ERROR) << "Couldn't import user certificate. " << PORT_GetError(); |
71 return ERR_ADD_USER_CERT_FAILED; | 71 return ERR_ADD_USER_CERT_FAILED; |
72 } | 72 } |
73 | 73 |
74 NotifyObserversOfCertAdded(cert_obj); | 74 NotifyObserversOfCertAdded(cert_obj); |
75 return OK; | 75 return OK; |
76 } | 76 } |
77 | 77 |
78 } // namespace net | 78 } // namespace net |
OLD | NEW |