#include "extensions/browser/api/socket/tls_socket.h"
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/api_resource.h"
#include "extensions/browser/api/socket/mojo_data_pump.h"
#include "net/base/address_list.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
#include "url/url_canon.h"
namespace extensions {
const char kTLSSocketTypeInvalidError[] = …;
TLSSocket::TLSSocket(
mojo::PendingRemote<network::mojom::TLSClientSocket> tls_socket,
const net::IPEndPoint& local_addr,
const net::IPEndPoint& peer_addr,
mojo::ScopedDataPipeConsumerHandle receive_stream,
mojo::ScopedDataPipeProducerHandle send_stream,
const std::string& owner_extension_id)
: … { … }
TLSSocket::~TLSSocket() { … }
void TLSSocket::Connect(const net::AddressList& address,
net::CompletionOnceCallback callback) { … }
void TLSSocket::Disconnect(bool socket_destroying) { … }
void TLSSocket::Read(int count, ReadCompletionCallback callback) { … }
void TLSSocket::Listen(const std::string& address,
uint16_t port,
int backlog,
ListenCallback callback) { … }
bool TLSSocket::IsConnected() { … }
bool TLSSocket::GetPeerAddress(net::IPEndPoint* address) { … }
bool TLSSocket::GetLocalAddress(net::IPEndPoint* address) { … }
Socket::SocketType TLSSocket::GetSocketType() const { … }
int TLSSocket::WriteImpl(net::IOBuffer* io_buffer,
int io_buffer_size,
net::CompletionOnceCallback callback) { … }
void TLSSocket::OnWriteComplete(net::CompletionOnceCallback callback,
int result) { … }
void TLSSocket::OnReadComplete(int result,
scoped_refptr<net::IOBuffer> io_buffer) { … }
}