OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // |state().certs| is still being validated and arranges for the given | 87 // |state().certs| is still being validated and arranges for the given |
88 // callback to be called when the verification completes. If the verification | 88 // callback to be called when the verification completes. If the verification |
89 // has already finished then WaitForCertVerification returns the result of | 89 // has already finished then WaitForCertVerification returns the result of |
90 // that verification. | 90 // that verification. |
91 int WaitForCertVerification(CompletionCallback* callback); | 91 int WaitForCertVerification(CompletionCallback* callback); |
92 | 92 |
93 base::TimeTicks verification_start_time() const { | 93 base::TimeTicks verification_start_time() const { |
94 return verification_start_time_; | 94 return verification_start_time_; |
95 } | 95 } |
96 | 96 |
| 97 base::TimeTicks verification_end_time() const { |
| 98 return verification_end_time_; |
| 99 } |
| 100 |
97 protected: | 101 protected: |
98 // Parse parses an opaque blob of data and fills out the public member fields | 102 // Parse parses an opaque blob of data and fills out the public member fields |
99 // of this object. It returns true iff the parse was successful. The public | 103 // of this object. It returns true iff the parse was successful. The public |
100 // member fields will be set to something sane in any case. | 104 // member fields will be set to something sane in any case. |
101 bool Parse(const std::string& data); | 105 bool Parse(const std::string& data); |
102 std::string Serialize() const; | 106 std::string Serialize() const; |
103 State state_; | 107 State state_; |
104 bool cert_verification_complete_; | 108 bool cert_verification_complete_; |
105 int cert_verification_error_; | 109 int cert_verification_error_; |
106 | 110 |
107 private: | 111 private: |
108 // This is the callback function which the CertVerifier calls via |callback_|. | 112 // This is the callback function which the CertVerifier calls via |callback_|. |
109 void VerifyCallback(int rv); | 113 void VerifyCallback(int rv); |
110 | 114 |
111 // This is the hostname that we'll validate the certificates against. | 115 // This is the hostname that we'll validate the certificates against. |
112 const std::string hostname_; | 116 const std::string hostname_; |
113 bool cert_parsing_failed_; | 117 bool cert_parsing_failed_; |
114 CompletionCallback* cert_verification_callback_; | 118 CompletionCallback* cert_verification_callback_; |
115 // These two members are taken from the SSLConfig. | 119 // These two members are taken from the SSLConfig. |
116 bool rev_checking_enabled_; | 120 bool rev_checking_enabled_; |
117 bool verify_ev_cert_; | 121 bool verify_ev_cert_; |
118 base::TimeTicks verification_start_time_; | 122 base::TimeTicks verification_start_time_; |
| 123 base::TimeTicks verification_end_time_; |
119 CertVerifyResult cert_verify_result_; | 124 CertVerifyResult cert_verify_result_; |
120 scoped_ptr<CertVerifier> verifier_; | 125 scoped_ptr<CertVerifier> verifier_; |
121 scoped_refptr<X509Certificate> cert_; | 126 scoped_refptr<X509Certificate> cert_; |
122 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; | 127 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; |
123 }; | 128 }; |
124 | 129 |
125 class SSLHostInfoFactory { | 130 class SSLHostInfoFactory { |
126 public: | 131 public: |
127 virtual ~SSLHostInfoFactory(); | 132 virtual ~SSLHostInfoFactory(); |
128 | 133 |
129 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname | 134 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname |
130 // or NULL on failure. | 135 // or NULL on failure. |
131 virtual SSLHostInfo* GetForHost(const std::string& hostname, | 136 virtual SSLHostInfo* GetForHost(const std::string& hostname, |
132 const SSLConfig& ssl_config) = 0; | 137 const SSLConfig& ssl_config) = 0; |
133 }; | 138 }; |
134 | 139 |
135 } // namespace net | 140 } // namespace net |
136 | 141 |
137 #endif // NET_SOCKET_SSL_HOST_INFO_H_ | 142 #endif // NET_SOCKET_SSL_HOST_INFO_H_ |
OLD | NEW |