| 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/sockets_tcp/sockets_tcp_api.h" | 5 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/storage_partition.h" | 9 #include "content/public/browser/storage_partition.h" |
| 10 #include "content/public/common/socket_permission_request.h" | 10 #include "content/public/common/socket_permission_request.h" |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 legacy_params.tls_version->min.reset( | 510 legacy_params.tls_version->min.reset( |
| 511 new std::string(*params_->options->tls_version->min.get())); | 511 new std::string(*params_->options->tls_version->min.get())); |
| 512 } | 512 } |
| 513 if (params_->options->tls_version->max.get()) { | 513 if (params_->options->tls_version->max.get()) { |
| 514 legacy_params.tls_version->max.reset( | 514 legacy_params.tls_version->max.reset( |
| 515 new std::string(*params_->options->tls_version->max.get())); | 515 new std::string(*params_->options->tls_version->max.get())); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 TLSSocket::UpgradeSocketToTLS( | 519 TLSSocket::UpgradeSocketToTLS( |
| 520 socket, | 520 socket, url_request_context->ssl_config_service(), |
| 521 url_request_context->ssl_config_service(), | |
| 522 url_request_context->cert_verifier(), | 521 url_request_context->cert_verifier(), |
| 523 url_request_context->transport_security_state(), | 522 url_request_context->transport_security_state(), |
| 524 extension_id(), | 523 url_request_context->cert_transparency_verifier(), |
| 525 &legacy_params, | 524 url_request_context->ct_policy_enforcer(), extension_id(), &legacy_params, |
| 526 base::Bind(&SocketsTcpSecureFunction::TlsConnectDone, this)); | 525 base::Bind(&SocketsTcpSecureFunction::TlsConnectDone, this)); |
| 527 } | 526 } |
| 528 | 527 |
| 529 void SocketsTcpSecureFunction::TlsConnectDone(std::unique_ptr<TLSSocket> socket, | 528 void SocketsTcpSecureFunction::TlsConnectDone(std::unique_ptr<TLSSocket> socket, |
| 530 int result) { | 529 int result) { |
| 531 // If an error occurred, socket MUST be NULL | 530 // If an error occurred, socket MUST be NULL |
| 532 DCHECK(result == net::OK || socket == NULL); | 531 DCHECK(result == net::OK || socket == NULL); |
| 533 | 532 |
| 534 if (socket && result == net::OK) { | 533 if (socket && result == net::OK) { |
| 535 socket->set_persistent(persistent_); | 534 socket->set_persistent(persistent_); |
| 536 socket->set_paused(paused_); | 535 socket->set_paused(paused_); |
| 537 ReplaceSocket(params_->socket_id, socket.release()); | 536 ReplaceSocket(params_->socket_id, socket.release()); |
| 538 } else { | 537 } else { |
| 539 RemoveSocket(params_->socket_id); | 538 RemoveSocket(params_->socket_id); |
| 540 error_ = net::ErrorToString(result); | 539 error_ = net::ErrorToString(result); |
| 541 } | 540 } |
| 542 | 541 |
| 543 results_ = api::sockets_tcp::Secure::Results::Create(result); | 542 results_ = api::sockets_tcp::Secure::Results::Create(result); |
| 544 AsyncWorkCompleted(); | 543 AsyncWorkCompleted(); |
| 545 } | 544 } |
| 546 | 545 |
| 547 } // namespace api | 546 } // namespace api |
| 548 } // namespace extensions | 547 } // namespace extensions |
| OLD | NEW |