OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "extensions/browser/api/socket/tls_socket.h" | 5 #include "extensions/browser/api/socket/tls_socket.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "extensions/browser/api/api_resource.h" | 9 #include "extensions/browser/api/api_resource.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 // static | 178 // static |
179 void TLSSocket::UpgradeSocketToTLS( | 179 void TLSSocket::UpgradeSocketToTLS( |
180 Socket* socket, | 180 Socket* socket, |
181 scoped_refptr<net::SSLConfigService> ssl_config_service, | 181 scoped_refptr<net::SSLConfigService> ssl_config_service, |
182 net::CertVerifier* cert_verifier, | 182 net::CertVerifier* cert_verifier, |
183 net::TransportSecurityState* transport_security_state, | 183 net::TransportSecurityState* transport_security_state, |
184 const std::string& extension_id, | 184 const std::string& extension_id, |
185 core_api::socket::SecureOptions* options, | 185 core_api::socket::SecureOptions* options, |
186 const TLSSocket::SecureCallback& callback) { | 186 const TLSSocket::SecureCallback& callback) { |
187 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); | 187 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
188 TCPSocket* tcp_socket = static_cast<TCPSocket*>(socket); | 188 TCPSocket* tcp_socket = static_cast<TCPSocket*>(socket); |
189 scoped_ptr<net::SSLClientSocket> null_sock; | 189 scoped_ptr<net::SSLClientSocket> null_sock; |
190 | 190 |
191 if (!tcp_socket || tcp_socket->GetSocketType() != Socket::TYPE_TCP || | 191 if (!tcp_socket || tcp_socket->GetSocketType() != Socket::TYPE_TCP || |
192 !tcp_socket->ClientStream() || !tcp_socket->IsConnected() || | 192 !tcp_socket->ClientStream() || !tcp_socket->IsConnected() || |
193 tcp_socket->HasPendingRead()) { | 193 tcp_socket->HasPendingRead()) { |
194 DVLOG(1) << "Failing before trying. socket is " << tcp_socket; | 194 DVLOG(1) << "Failing before trying. socket is " << tcp_socket; |
195 if (tcp_socket) { | 195 if (tcp_socket) { |
196 DVLOG(1) << "type: " << tcp_socket->GetSocketType() | 196 DVLOG(1) << "type: " << tcp_socket->GetSocketType() |
197 << ", ClientStream is " << tcp_socket->ClientStream() | 197 << ", ClientStream is " << tcp_socket->ClientStream() |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 if (status != net::OK) { | 300 if (status != net::OK) { |
301 DVLOG(1) << "Status is not OK or IO-pending: " | 301 DVLOG(1) << "Status is not OK or IO-pending: " |
302 << net::ErrorToString(status); | 302 << net::ErrorToString(status); |
303 } | 303 } |
304 connect_cb.Run(status); | 304 connect_cb.Run(status); |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 } // namespace extensions | 308 } // namespace extensions |
309 | 309 |
OLD | NEW |