Chromium Code Reviews| Index: net/cert/cert_verifier.h |
| diff --git a/net/cert/cert_verifier.h b/net/cert/cert_verifier.h |
| index 6e5eac98e4fa0152cffdf1cc208682c9d17c28a0..9f6d7f7240a4adac294a0230a5468a1adf32d2bc 100644 |
| --- a/net/cert/cert_verifier.h |
| +++ b/net/cert/cert_verifier.h |
| @@ -14,6 +14,7 @@ |
| namespace net { |
| class BoundNetLog; |
| +class CertVerifyProc; |
| class CertVerifyResult; |
| class CRLSet; |
| class X509Certificate; |
| @@ -75,7 +76,7 @@ class NET_EXPORT CertVerifier { |
| // When the verifier is destroyed, all certificate verification requests are |
| // canceled, and their completion callbacks will not be called. |
| - virtual ~CertVerifier() {} |
| + virtual ~CertVerifier(); |
| // Verifies the given certificate against the given hostname as an SSL server. |
| // Returns OK if successful or an error code upon failure. |
| @@ -129,6 +130,31 @@ class NET_EXPORT CertVerifier { |
| // Creates a CertVerifier implementation that verifies certificates using |
| // the preferred underlying cryptographic libraries. |
| static CertVerifier* CreateDefault(); |
| + |
| + static CertVerifier* CreateWithVerifyProc(CertVerifyProc* cert_verify_proc); |
|
Ryan Sleevi
2015/07/09 19:35:28
Why the need to expose this interface?
I really d
estark
2015/07/09 20:14:24
So I'm trying to use this instead of places where
|
| +}; |
| + |
| +// CertVerifierFactory creates CertVerifiers. There is a single global |
| +// CertVerifierFactory, which allows tests to inject mock verifiers. |
| +class NET_EXPORT CertVerifierFactory { |
|
Ryan Sleevi
2015/07/09 19:35:27
This is a design I intentionally wanted to avoid a
estark
2015/07/09 20:11:50
Email thread with you me and Matt titled "MockCert
|
| + public: |
| + CertVerifierFactory(); |
| + virtual ~CertVerifierFactory(); |
| + |
| + // Creates a new CertVerifier which will use the given |
| + // |cert_verify_proc|. Ownership of the returned CertVerifier is |
| + // assumed by the caller. The CertVerifier will own the given |
| + // |cert_verify_proc|. |
| + virtual CertVerifier* CreateCertVerifier(CertVerifyProc* cert_verify_proc); |
| + |
| + // Gets and sets the the global CertVerifierFactory. |
| + static CertVerifierFactory* GetCertVerifierFactory(); |
| + static void SetCertVerifierFactory(CertVerifierFactory* factory); |
| + |
| + private: |
| + static CertVerifierFactory* cert_verifier_factory_; |
|
Ryan Sleevi
2015/07/09 19:40:26
There's (generally) no need for such private stati
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(CertVerifierFactory); |
| }; |
| } // namespace net |