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_CLIENT_SOCKET_HANDLE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Used by ClientSocketPool to initialize the ClientSocketHandle. | 102 // Used by ClientSocketPool to initialize the ClientSocketHandle. |
103 void set_is_reused(bool is_reused) { is_reused_ = is_reused; } | 103 void set_is_reused(bool is_reused) { is_reused_ = is_reused; } |
104 void set_socket(ClientSocket* s) { socket_.reset(s); } | 104 void set_socket(ClientSocket* s) { socket_.reset(s); } |
105 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } | 105 void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } |
106 void set_pool_id(int id) { pool_id_ = id; } | 106 void set_pool_id(int id) { pool_id_ = id; } |
107 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } | 107 void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } |
108 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) { | 108 void set_ssl_error_response_info(const HttpResponseInfo& ssl_error_state) { |
109 ssl_error_response_info_ = ssl_error_state; | 109 ssl_error_response_info_ = ssl_error_state; |
110 } | 110 } |
| 111 void set_pending_http_proxy_connection(ClientSocketHandle* connection) { |
| 112 pending_http_proxy_connection_.reset(connection); |
| 113 } |
111 | 114 |
112 // Only valid if there is no |socket_|. | 115 // Only valid if there is no |socket_|. |
113 bool is_ssl_error() const { | 116 bool is_ssl_error() const { |
114 DCHECK(socket_.get() == NULL); | 117 DCHECK(socket_.get() == NULL); |
115 return is_ssl_error_; | 118 return is_ssl_error_; |
116 } | 119 } |
117 // On an ERR_PROXY_AUTH_REQUESTED error, the |headers| and |auth_challenge| | 120 // On an ERR_PROXY_AUTH_REQUESTED error, the |headers| and |auth_challenge| |
118 // fields are filled in. On an ERR_SSL_CLIENT_AUTH_CERT_NEEDED error, | 121 // fields are filled in. On an ERR_SSL_CLIENT_AUTH_CERT_NEEDED error, |
119 // the |cert_request_info| field is set. | 122 // the |cert_request_info| field is set. |
120 const HttpResponseInfo& ssl_error_response_info() const { | 123 const HttpResponseInfo& ssl_error_response_info() const { |
121 return ssl_error_response_info_; | 124 return ssl_error_response_info_; |
122 } | 125 } |
| 126 ClientSocketHandle* release_pending_http_proxy_connection() { |
| 127 return pending_http_proxy_connection_.release(); |
| 128 } |
123 | 129 |
124 // These may only be used if is_initialized() is true. | 130 // These may only be used if is_initialized() is true. |
125 const std::string& group_name() const { return group_name_; } | 131 const std::string& group_name() const { return group_name_; } |
126 int id() const { return pool_id_; } | 132 int id() const { return pool_id_; } |
127 ClientSocket* socket() { return socket_.get(); } | 133 ClientSocket* socket() { return socket_.get(); } |
128 ClientSocket* release_socket() { return socket_.release(); } | 134 ClientSocket* release_socket() { return socket_.release(); } |
129 bool is_reused() const { return is_reused_; } | 135 bool is_reused() const { return is_reused_; } |
130 base::TimeDelta idle_time() const { return idle_time_; } | 136 base::TimeDelta idle_time() const { return idle_time_; } |
131 SocketReuseType reuse_type() const { | 137 SocketReuseType reuse_type() const { |
132 if (is_reused()) { | 138 if (is_reused()) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 scoped_refptr<ClientSocketPool> pool_; | 177 scoped_refptr<ClientSocketPool> pool_; |
172 scoped_ptr<ClientSocket> socket_; | 178 scoped_ptr<ClientSocket> socket_; |
173 std::string group_name_; | 179 std::string group_name_; |
174 bool is_reused_; | 180 bool is_reused_; |
175 CompletionCallbackImpl<ClientSocketHandle> callback_; | 181 CompletionCallbackImpl<ClientSocketHandle> callback_; |
176 CompletionCallback* user_callback_; | 182 CompletionCallback* user_callback_; |
177 base::TimeDelta idle_time_; | 183 base::TimeDelta idle_time_; |
178 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. | 184 int pool_id_; // See ClientSocketPool::ReleaseSocket() for an explanation. |
179 bool is_ssl_error_; | 185 bool is_ssl_error_; |
180 HttpResponseInfo ssl_error_response_info_; | 186 HttpResponseInfo ssl_error_response_info_; |
| 187 scoped_ptr<ClientSocketHandle> pending_http_proxy_connection_; |
181 base::TimeTicks init_time_; | 188 base::TimeTicks init_time_; |
182 base::TimeDelta setup_time_; | 189 base::TimeDelta setup_time_; |
183 | 190 |
184 NetLog::Source requesting_source_; | 191 NetLog::Source requesting_source_; |
185 | 192 |
186 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); | 193 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); |
187 }; | 194 }; |
188 | 195 |
189 // Template function implementation: | 196 // Template function implementation: |
190 template <typename SocketParams, typename PoolType> | 197 template <typename SocketParams, typename PoolType> |
(...skipping 21 matching lines...) Expand all Loading... |
212 user_callback_ = callback; | 219 user_callback_ = callback; |
213 } else { | 220 } else { |
214 HandleInitCompletion(rv); | 221 HandleInitCompletion(rv); |
215 } | 222 } |
216 return rv; | 223 return rv; |
217 } | 224 } |
218 | 225 |
219 } // namespace net | 226 } // namespace net |
220 | 227 |
221 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ | 228 #endif // NET_SOCKET_CLIENT_SOCKET_HANDLE_H_ |
OLD | NEW |