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 #ifndef NET_CERT_CERT_DATABASE_H_ | 5 #ifndef NET_CERT_CERT_DATABASE_H_ |
6 #define NET_CERT_CERT_DATABASE_H_ | 6 #define NET_CERT_CERT_DATABASE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "net/base/net_errors.h" |
11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
12 #include "net/cert/x509_certificate.h" | 13 #include "net/cert/x509_certificate.h" |
13 | 14 |
14 template <typename T> struct DefaultSingletonTraits; | 15 template <typename T> struct DefaultSingletonTraits; |
15 template <class ObserverType> class ObserverListThreadSafe; | 16 template <class ObserverType> class ObserverListThreadSafe; |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 class NSSCertDatabase; | 20 class NSSCertDatabase; |
20 | 21 |
(...skipping 30 matching lines...) Expand all Loading... |
51 | 52 |
52 private: | 53 private: |
53 DISALLOW_COPY_AND_ASSIGN(Observer); | 54 DISALLOW_COPY_AND_ASSIGN(Observer); |
54 }; | 55 }; |
55 | 56 |
56 // Returns the CertDatabase singleton. | 57 // Returns the CertDatabase singleton. |
57 static CertDatabase* GetInstance(); | 58 static CertDatabase* GetInstance(); |
58 | 59 |
59 // Check whether this is a valid user cert that we have the private key for. | 60 // Check whether this is a valid user cert that we have the private key for. |
60 // Returns OK or a network error code such as ERR_CERT_CONTAINS_ERRORS. | 61 // Returns OK or a network error code such as ERR_CERT_CONTAINS_ERRORS. |
61 int CheckUserCert(X509Certificate* cert); | 62 Error CheckUserCert(X509Certificate* cert); |
62 | 63 |
63 // Store user (client) certificate. Assumes CheckUserCert has already passed. | 64 // Store user (client) certificate. Assumes CheckUserCert has already passed. |
64 // Returns OK, or ERR_ADD_USER_CERT_FAILED if there was a problem saving to | 65 // Returns OK, or ERR_ADD_USER_CERT_FAILED if there was a problem saving to |
65 // the platform cert database, or possibly other network error codes. | 66 // the platform cert database, or possibly other network error codes. |
66 int AddUserCert(X509Certificate* cert); | 67 Error AddUserCert(X509Certificate* cert); |
67 | 68 |
68 // Registers |observer| to receive notifications of certificate changes. The | 69 // Registers |observer| to receive notifications of certificate changes. The |
69 // thread on which this is called is the thread on which |observer| will be | 70 // thread on which this is called is the thread on which |observer| will be |
70 // called back with notifications. | 71 // called back with notifications. |
71 void AddObserver(Observer* observer); | 72 void AddObserver(Observer* observer); |
72 | 73 |
73 // Unregisters |observer| from receiving notifications. This must be called | 74 // Unregisters |observer| from receiving notifications. This must be called |
74 // on the same thread on which AddObserver() was called. | 75 // on the same thread on which AddObserver() was called. |
75 void RemoveObserver(Observer* observer); | 76 void RemoveObserver(Observer* observer); |
76 | 77 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 friend class Notifier; | 118 friend class Notifier; |
118 scoped_ptr<Notifier> notifier_; | 119 scoped_ptr<Notifier> notifier_; |
119 #endif | 120 #endif |
120 | 121 |
121 DISALLOW_COPY_AND_ASSIGN(CertDatabase); | 122 DISALLOW_COPY_AND_ASSIGN(CertDatabase); |
122 }; | 123 }; |
123 | 124 |
124 } // namespace net | 125 } // namespace net |
125 | 126 |
126 #endif // NET_CERT_CERT_DATABASE_H_ | 127 #endif // NET_CERT_CERT_DATABASE_H_ |
OLD | NEW |