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