Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: extensions/browser/api/socket/tls_socket.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return Socket::TYPE_TLS; 172 return Socket::TYPE_TLS;
173 } 173 }
174 174
175 // static 175 // static
176 void TLSSocket::UpgradeSocketToTLS( 176 void TLSSocket::UpgradeSocketToTLS(
177 Socket* socket, 177 Socket* socket,
178 scoped_refptr<net::SSLConfigService> ssl_config_service, 178 scoped_refptr<net::SSLConfigService> ssl_config_service,
179 net::CertVerifier* cert_verifier, 179 net::CertVerifier* cert_verifier,
180 net::TransportSecurityState* transport_security_state, 180 net::TransportSecurityState* transport_security_state,
181 const std::string& extension_id, 181 const std::string& extension_id,
182 core_api::socket::SecureOptions* options, 182 api::socket::SecureOptions* options,
183 const TLSSocket::SecureCallback& callback) { 183 const TLSSocket::SecureCallback& callback) {
184 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 184 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
185 TCPSocket* tcp_socket = static_cast<TCPSocket*>(socket); 185 TCPSocket* tcp_socket = static_cast<TCPSocket*>(socket);
186 scoped_ptr<net::SSLClientSocket> null_sock; 186 scoped_ptr<net::SSLClientSocket> null_sock;
187 187
188 if (!tcp_socket || tcp_socket->GetSocketType() != Socket::TYPE_TCP || 188 if (!tcp_socket || tcp_socket->GetSocketType() != Socket::TYPE_TCP ||
189 !tcp_socket->ClientStream() || !tcp_socket->IsConnected() || 189 !tcp_socket->ClientStream() || !tcp_socket->IsConnected() ||
190 tcp_socket->HasPendingRead()) { 190 tcp_socket->HasPendingRead()) {
191 DVLOG(1) << "Failing before trying. socket is " << tcp_socket; 191 DVLOG(1) << "Failing before trying. socket is " << tcp_socket;
192 if (tcp_socket) { 192 if (tcp_socket) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 DCHECK(transport_security_state); 237 DCHECK(transport_security_state);
238 net::SSLClientSocketContext context; 238 net::SSLClientSocketContext context;
239 context.cert_verifier = cert_verifier; 239 context.cert_verifier = cert_verifier;
240 context.transport_security_state = transport_security_state; 240 context.transport_security_state = transport_security_state;
241 241
242 // Fill in the SSL socket params. 242 // Fill in the SSL socket params.
243 net::SSLConfig ssl_config; 243 net::SSLConfig ssl_config;
244 ssl_config_service->GetSSLConfig(&ssl_config); 244 ssl_config_service->GetSSLConfig(&ssl_config);
245 if (options && options->tls_version.get()) { 245 if (options && options->tls_version.get()) {
246 uint16 version_min = 0, version_max = 0; 246 uint16 version_min = 0, version_max = 0;
247 core_api::socket::TLSVersionConstraints* versions = 247 api::socket::TLSVersionConstraints* versions = options->tls_version.get();
248 options->tls_version.get();
249 if (versions->min.get()) { 248 if (versions->min.get()) {
250 version_min = SSLProtocolVersionFromString(*versions->min.get()); 249 version_min = SSLProtocolVersionFromString(*versions->min.get());
251 } 250 }
252 if (versions->max.get()) { 251 if (versions->max.get()) {
253 version_max = SSLProtocolVersionFromString(*versions->max.get()); 252 version_max = SSLProtocolVersionFromString(*versions->max.get());
254 } 253 }
255 if (version_min) { 254 if (version_min) {
256 ssl_config.version_min = version_min; 255 ssl_config.version_min = version_min;
257 } 256 }
258 if (version_max) { 257 if (version_max) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 if (status != net::OK) { 296 if (status != net::OK) {
298 DVLOG(1) << "Status is not OK or IO-pending: " 297 DVLOG(1) << "Status is not OK or IO-pending: "
299 << net::ErrorToString(status); 298 << net::ErrorToString(status);
300 } 299 }
301 connect_cb.Run(status); 300 connect_cb.Run(status);
302 } 301 }
303 } 302 }
304 303
305 } // namespace extensions 304 } // namespace extensions
306 305
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/tls_socket.h ('k') | extensions/browser/api/sockets_tcp/sockets_tcp_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698