OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SOCKET_SSL_HOST_INFO_H_ | 5 #ifndef NET_SOCKET_SSL_HOST_INFO_H_ |
6 #define NET_SOCKET_SSL_HOST_INFO_H_ | 6 #define NET_SOCKET_SSL_HOST_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // WaitForDataReady returns OK if the fetch of the requested data has | 44 // WaitForDataReady returns OK if the fetch of the requested data has |
45 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on | 45 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on |
46 // the current thread when ready. | 46 // the current thread when ready. |
47 // | 47 // |
48 // Only a single callback can be outstanding at a given time and, in the | 48 // Only a single callback can be outstanding at a given time and, in the |
49 // event that WaitForDataReady returns OK, it's the caller's responsibility | 49 // event that WaitForDataReady returns OK, it's the caller's responsibility |
50 // to delete |callback|. | 50 // to delete |callback|. |
51 // | 51 // |
52 // |callback| may be NULL, in which case ERR_IO_PENDING may still be returned | 52 // |callback| may be NULL, in which case ERR_IO_PENDING may still be returned |
53 // but, obviously, a callback will never be made. | 53 // but, obviously, a callback will never be made. |
54 virtual int WaitForDataReady(OldCompletionCallback* callback) = 0; | 54 virtual int WaitForDataReady(const CompletionCallback& callback) = 0; |
55 | 55 |
56 // Persist allows for the host information to be updated for future users. | 56 // Persist allows for the host information to be updated for future users. |
57 // This is a fire and forget operation: the caller may drop its reference | 57 // This is a fire and forget operation: the caller may drop its reference |
58 // from this object and the store operation will still complete. This can | 58 // from this object and the store operation will still complete. This can |
59 // only be called once WaitForDataReady has returned OK or called its | 59 // only be called once WaitForDataReady has returned OK or called its |
60 // callback. | 60 // callback. |
61 virtual void Persist() = 0; | 61 virtual void Persist() = 0; |
62 | 62 |
63 // StartDnsLookup triggers a DNS lookup for the host. | 63 // StartDnsLookup triggers a DNS lookup for the host. |
64 void StartDnsLookup(DnsRRResolver* dnsrr_resolver); | 64 void StartDnsLookup(DnsRRResolver* dnsrr_resolver); |
(...skipping 19 matching lines...) Expand all Loading... |
84 | 84 |
85 // If WaitForCertVerification reports the certificate verification has | 85 // If WaitForCertVerification reports the certificate verification has |
86 // completed, then this contains the result of verifying the certificate. | 86 // completed, then this contains the result of verifying the certificate. |
87 const CertVerifyResult& cert_verify_result() const; | 87 const CertVerifyResult& cert_verify_result() const; |
88 | 88 |
89 // WaitForCertVerification returns ERR_IO_PENDING if the certificate chain in | 89 // WaitForCertVerification returns ERR_IO_PENDING if the certificate chain in |
90 // |state().certs| is still being validated and arranges for the given | 90 // |state().certs| is still being validated and arranges for the given |
91 // callback to be called when the verification completes. If the verification | 91 // callback to be called when the verification completes. If the verification |
92 // has already finished then WaitForCertVerification returns the result of | 92 // has already finished then WaitForCertVerification returns the result of |
93 // that verification. | 93 // that verification. |
94 int WaitForCertVerification(OldCompletionCallback* callback); | 94 int WaitForCertVerification(const CompletionCallback& callback); |
95 | 95 |
96 base::TimeTicks verification_start_time() const { | 96 base::TimeTicks verification_start_time() const { |
97 return verification_start_time_; | 97 return verification_start_time_; |
98 } | 98 } |
99 | 99 |
100 base::TimeTicks verification_end_time() const { | 100 base::TimeTicks verification_end_time() const { |
101 return verification_end_time_; | 101 return verification_end_time_; |
102 } | 102 } |
103 | 103 |
104 protected: | 104 protected: |
105 // Parse parses an opaque blob of data and fills out the public member fields | 105 // Parse parses an opaque blob of data and fills out the public member fields |
106 // of this object. It returns true iff the parse was successful. The public | 106 // of this object. It returns true iff the parse was successful. The public |
107 // member fields will be set to something sane in any case. | 107 // member fields will be set to something sane in any case. |
108 bool Parse(const std::string& data); | 108 bool Parse(const std::string& data); |
109 std::string Serialize() const; | 109 std::string Serialize() const; |
110 State state_; | 110 State state_; |
111 bool cert_verification_complete_; | 111 bool cert_verification_complete_; |
112 int cert_verification_error_; | 112 int cert_verification_error_; |
113 | 113 |
114 private: | 114 private: |
115 // This is the callback function which the CertVerifier calls via |callback_|. | 115 // This is the callback function which the CertVerifier calls via |callback_|. |
116 void VerifyCallback(int rv); | 116 void VerifyCallback(int rv); |
117 | 117 |
118 // ParseInner is a helper function for Parse. | 118 // ParseInner is a helper function for Parse. |
119 bool ParseInner(const std::string& data); | 119 bool ParseInner(const std::string& data); |
120 | 120 |
121 // This is the hostname that we'll validate the certificates against. | 121 // This is the hostname that we'll validate the certificates against. |
122 const std::string hostname_; | 122 const std::string hostname_; |
123 bool cert_parsing_failed_; | 123 bool cert_parsing_failed_; |
124 OldCompletionCallback* cert_verification_callback_; | 124 CompletionCallback cert_verification_callback_; |
125 // These three members are taken from the SSLConfig. | 125 // These three members are taken from the SSLConfig. |
126 bool rev_checking_enabled_; | 126 bool rev_checking_enabled_; |
127 bool verify_ev_cert_; | 127 bool verify_ev_cert_; |
128 scoped_refptr<CRLSet> crl_set_; | 128 scoped_refptr<CRLSet> crl_set_; |
129 base::TimeTicks verification_start_time_; | 129 base::TimeTicks verification_start_time_; |
130 base::TimeTicks verification_end_time_; | 130 base::TimeTicks verification_end_time_; |
131 CertVerifyResult cert_verify_result_; | 131 CertVerifyResult cert_verify_result_; |
132 SingleRequestCertVerifier verifier_; | 132 SingleRequestCertVerifier verifier_; |
133 scoped_refptr<X509Certificate> cert_; | 133 scoped_refptr<X509Certificate> cert_; |
134 base::WeakPtrFactory<SSLHostInfo> weak_factory_; | 134 base::WeakPtrFactory<SSLHostInfo> weak_factory_; |
(...skipping 12 matching lines...) Expand all Loading... |
147 | 147 |
148 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname | 148 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname |
149 // or NULL on failure. | 149 // or NULL on failure. |
150 virtual SSLHostInfo* GetForHost(const std::string& hostname, | 150 virtual SSLHostInfo* GetForHost(const std::string& hostname, |
151 const SSLConfig& ssl_config) = 0; | 151 const SSLConfig& ssl_config) = 0; |
152 }; | 152 }; |
153 | 153 |
154 } // namespace net | 154 } // namespace net |
155 | 155 |
156 #endif // NET_SOCKET_SSL_HOST_INFO_H_ | 156 #endif // NET_SOCKET_SSL_HOST_INFO_H_ |
OLD | NEW |