OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ | 5 #ifndef IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ |
6 #define IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ | 6 #define IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "net/cert/cert_verifier.h" | 9 #include "net/cert/cert_verifier.h" |
10 #include "net/log/net_log.h" | 10 #include "net/log/net_log.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 class CertVerifyResult; | 14 class CertVerifyResult; |
15 class CRLSet; | 15 class CRLSet; |
16 class X509Certificate; | 16 class X509Certificate; |
17 | 17 |
18 // Provides block-based interface for net::CertVerifier. | 18 // Provides block-based interface for net::CertVerifier. |
19 class CertVerifierBlockAdapter { | 19 class CertVerifierBlockAdapter { |
20 public: | 20 public: |
21 CertVerifierBlockAdapter(); | 21 CertVerifierBlockAdapter(); |
22 // Constructs adapter with given |CertVerifier| which can not be null. | 22 // Constructs adapter with given |CertVerifier| which can not be null. |
23 CertVerifierBlockAdapter(scoped_ptr<CertVerifier> cert_verifier); | 23 CertVerifierBlockAdapter(scoped_ptr<CertVerifier> cert_verifier); |
24 | 24 |
25 // When the verifier is destroyed, all certificate verification requests are | 25 // When the verifier is destroyed, all certificate verification requests are |
26 // canceled, and their completion handlers will not be called. | 26 // canceled, and their completion handlers will not be called. |
27 ~CertVerifierBlockAdapter(); | 27 ~CertVerifierBlockAdapter(); |
28 | 28 |
29 // Encapsulates verification parms. |cert| and |hostname| are mandatory, the | 29 // Encapsulates verification parms. |cert| and |hostname| are mandatory, the |
30 // other params are optional. | 30 // other params are optional. If either of mandatory arguments is null or |
| 31 // empty then verification |CompletionHandler| will be called with |
| 32 // ERR_INVALID_ARGUMENT status. |
31 struct Params { | 33 struct Params { |
32 // Constructs Params from X509 cert and hostname, which are mandatory for | 34 // Constructs Params from X509 cert and hostname, which are mandatory for |
33 // verification. | 35 // verification. |
34 Params(scoped_refptr<net::X509Certificate> cert, | 36 Params(scoped_refptr<net::X509Certificate> cert, |
35 const std::string& hostname); | 37 const std::string& hostname); |
36 ~Params(); | 38 ~Params(); |
37 | 39 |
38 // Certificate to verify, can not be null. | 40 // Certificate to verify, can not be null. |
39 scoped_refptr<net::X509Certificate> cert; | 41 scoped_refptr<net::X509Certificate> cert; |
40 | 42 |
(...skipping 24 matching lines...) Expand all Loading... |
65 private: | 67 private: |
66 // Underlying CertVerifier. | 68 // Underlying CertVerifier. |
67 scoped_ptr<CertVerifier> cert_verifier_; | 69 scoped_ptr<CertVerifier> cert_verifier_; |
68 // Net Log required by CertVerifier. | 70 // Net Log required by CertVerifier. |
69 BoundNetLog net_log_; | 71 BoundNetLog net_log_; |
70 }; | 72 }; |
71 | 73 |
72 } // net | 74 } // net |
73 | 75 |
74 #endif // IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ | 76 #endif // IOS_WEB_NET_CERT_VERIFIER_BLOCK_ADAPTER_H_ |
OLD | NEW |