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