Commit 89a75d27 authored by Helen Li's avatar Helen Li Committed by Commit Bot

Reorder methods in proxy_resolving_client_socket.cc to match header file

This CL reorders methods in proxy_resolving_client_socket.cc to match that in
the header file.

Bug: 721401
Change-Id: Id9fb467c335e88f2437ce649d1f969109731d22d
Reviewed-on: https://chromium-review.googlesource.com/847286Reviewed-by: default avatarRandy Smith <rdsmith@chromium.org>
Commit-Queue: Helen Li <xunjieli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526703}
parent eb9b0961
......@@ -164,6 +164,102 @@ int ProxyResolvingClientSocket::Connect(
return net::ERR_IO_PENDING;
}
void ProxyResolvingClientSocket::Disconnect() {
CloseTransportSocket();
if (pac_request_) {
network_session_->proxy_service()->CancelPacRequest(pac_request_);
pac_request_ = NULL;
}
user_connect_callback_.Reset();
}
bool ProxyResolvingClientSocket::IsConnected() const {
if (!transport_.get() || !transport_->socket())
return false;
return transport_->socket()->IsConnected();
}
bool ProxyResolvingClientSocket::IsConnectedAndIdle() const {
if (!transport_.get() || !transport_->socket())
return false;
return transport_->socket()->IsConnectedAndIdle();
}
int ProxyResolvingClientSocket::GetPeerAddress(net::IPEndPoint* address) const {
if (!transport_.get() || !transport_->socket()) {
return net::ERR_SOCKET_NOT_CONNECTED;
}
if (proxy_info_.is_direct())
return transport_->socket()->GetPeerAddress(address);
net::IPAddress ip_address;
if (!ip_address.AssignFromIPLiteral(url_.HostNoBrackets())) {
// Do not expose the proxy IP address to the caller.
return net::ERR_NAME_NOT_RESOLVED;
}
*address = net::IPEndPoint(ip_address, url_.EffectiveIntPort());
return net::OK;
}
int ProxyResolvingClientSocket::GetLocalAddress(
net::IPEndPoint* address) const {
if (transport_.get() && transport_->socket())
return transport_->socket()->GetLocalAddress(address);
return net::ERR_SOCKET_NOT_CONNECTED;
}
const net::NetLogWithSource& ProxyResolvingClientSocket::NetLog() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->NetLog();
return net_log_;
}
void ProxyResolvingClientSocket::SetSubresourceSpeculation() {
if (transport_.get() && transport_->socket())
transport_->socket()->SetSubresourceSpeculation();
}
void ProxyResolvingClientSocket::SetOmniboxSpeculation() {
if (transport_.get() && transport_->socket())
transport_->socket()->SetOmniboxSpeculation();
}
bool ProxyResolvingClientSocket::WasEverUsed() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->WasEverUsed();
return false;
}
bool ProxyResolvingClientSocket::WasAlpnNegotiated() const {
return false;
}
net::NextProto ProxyResolvingClientSocket::GetNegotiatedProtocol() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->GetNegotiatedProtocol();
return net::kProtoUnknown;
}
bool ProxyResolvingClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) {
return false;
}
void ProxyResolvingClientSocket::GetConnectionAttempts(
net::ConnectionAttempts* out) const {
out->clear();
}
int64_t ProxyResolvingClientSocket::GetTotalReceivedBytes() const {
NOTIMPLEMENTED();
return 0;
}
void ProxyResolvingClientSocket::ApplySocketTag(const net::SocketTag& tag) {
NOTIMPLEMENTED();
}
void ProxyResolvingClientSocket::ConnectToProxy(int net_error) {
pac_request_ = NULL;
......@@ -232,6 +328,12 @@ void ProxyResolvingClientSocket::ConnectToProxyDone(int net_error) {
base::ResetAndReturn(&user_connect_callback_).Run(net_error);
}
void ProxyResolvingClientSocket::CloseTransportSocket() {
if (transport_.get() && transport_->socket())
transport_->socket()->Disconnect();
transport_.reset();
}
// TODO(xunjieli): This following method is out of sync with
// HttpStreamFactoryImpl::JobController. The logic should be refactored into a
// common place.
......@@ -321,106 +423,4 @@ int ProxyResolvingClientSocket::ReconsiderProxyAfterError(int error) {
return rv;
}
void ProxyResolvingClientSocket::Disconnect() {
CloseTransportSocket();
if (pac_request_) {
network_session_->proxy_service()->CancelPacRequest(pac_request_);
pac_request_ = NULL;
}
user_connect_callback_.Reset();
}
bool ProxyResolvingClientSocket::IsConnected() const {
if (!transport_.get() || !transport_->socket())
return false;
return transport_->socket()->IsConnected();
}
bool ProxyResolvingClientSocket::IsConnectedAndIdle() const {
if (!transport_.get() || !transport_->socket())
return false;
return transport_->socket()->IsConnectedAndIdle();
}
int ProxyResolvingClientSocket::GetPeerAddress(net::IPEndPoint* address) const {
if (!transport_.get() || !transport_->socket()) {
return net::ERR_SOCKET_NOT_CONNECTED;
}
if (proxy_info_.is_direct())
return transport_->socket()->GetPeerAddress(address);
net::IPAddress ip_address;
if (!ip_address.AssignFromIPLiteral(url_.HostNoBrackets())) {
// Do not expose the proxy IP address to the caller.
return net::ERR_NAME_NOT_RESOLVED;
}
*address = net::IPEndPoint(ip_address, url_.EffectiveIntPort());
return net::OK;
}
int ProxyResolvingClientSocket::GetLocalAddress(
net::IPEndPoint* address) const {
if (transport_.get() && transport_->socket())
return transport_->socket()->GetLocalAddress(address);
return net::ERR_SOCKET_NOT_CONNECTED;
}
const net::NetLogWithSource& ProxyResolvingClientSocket::NetLog() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->NetLog();
return net_log_;
}
void ProxyResolvingClientSocket::SetSubresourceSpeculation() {
if (transport_.get() && transport_->socket())
transport_->socket()->SetSubresourceSpeculation();
}
void ProxyResolvingClientSocket::SetOmniboxSpeculation() {
if (transport_.get() && transport_->socket())
transport_->socket()->SetOmniboxSpeculation();
}
bool ProxyResolvingClientSocket::WasEverUsed() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->WasEverUsed();
return false;
}
bool ProxyResolvingClientSocket::WasAlpnNegotiated() const {
return false;
}
net::NextProto ProxyResolvingClientSocket::GetNegotiatedProtocol() const {
if (transport_.get() && transport_->socket())
return transport_->socket()->GetNegotiatedProtocol();
return net::kProtoUnknown;
}
bool ProxyResolvingClientSocket::GetSSLInfo(net::SSLInfo* ssl_info) {
return false;
}
void ProxyResolvingClientSocket::GetConnectionAttempts(
net::ConnectionAttempts* out) const {
out->clear();
}
int64_t ProxyResolvingClientSocket::GetTotalReceivedBytes() const {
NOTIMPLEMENTED();
return 0;
}
void ProxyResolvingClientSocket::ApplySocketTag(const net::SocketTag& tag) {
NOTIMPLEMENTED();
}
void ProxyResolvingClientSocket::CloseTransportSocket() {
if (transport_.get() && transport_->socket())
transport_->socket()->Disconnect();
transport_.reset();
}
} // namespace network
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment