| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "net/websockets/websocket_stream.h" | 5 #include "net/websockets/websocket_stream.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 DCHECK(handshake_stream_); | 147 DCHECK(handshake_stream_); |
| 148 | 148 |
| 149 timer_->Stop(); | 149 timer_->Stop(); |
| 150 | 150 |
| 151 std::unique_ptr<URLRequest> url_request = std::move(url_request_); | 151 std::unique_ptr<URLRequest> url_request = std::move(url_request_); |
| 152 WebSocketHandshakeStreamBase* handshake_stream = handshake_stream_; | 152 WebSocketHandshakeStreamBase* handshake_stream = handshake_stream_; |
| 153 handshake_stream_ = nullptr; | 153 handshake_stream_ = nullptr; |
| 154 connect_delegate_->OnSuccess(handshake_stream->Upgrade()); | 154 connect_delegate_->OnSuccess(handshake_stream->Upgrade()); |
| 155 | 155 |
| 156 // This is safe even if |this| has already been deleted. | 156 // This is safe even if |this| has already been deleted. |
| 157 url_request->CancelWithError(ERR_WEBSOCKET_HANDSHAKE_SUCCESS); | 157 url_request->CancelWithError(ERR_WS_UPGRADE); |
| 158 } | 158 } |
| 159 | 159 |
| 160 std::string FailureMessageFromNetError(int net_error) { | 160 std::string FailureMessageFromNetError(int net_error) { |
| 161 if (net_error == ERR_TUNNEL_CONNECTION_FAILED) { | 161 if (net_error == ERR_TUNNEL_CONNECTION_FAILED) { |
| 162 // This error is common and confusing, so special-case it. | 162 // This error is common and confusing, so special-case it. |
| 163 // TODO(ricea): Include the HostPortPair of the selected proxy server in | 163 // TODO(ricea): Include the HostPortPair of the selected proxy server in |
| 164 // the error message. This is not currently possible because it isn't set | 164 // the error message. This is not currently possible because it isn't set |
| 165 // in HttpResponseInfo when a ERR_TUNNEL_CONNECTION_FAILED error happens. | 165 // in HttpResponseInfo when a ERR_TUNNEL_CONNECTION_FAILED error happens. |
| 166 return "Establishing a tunnel via proxy server failed."; | 166 return "Establishing a tunnel via proxy server failed."; |
| 167 } else { | 167 } else { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 DCHECK(connect_delegate); | 407 DCHECK(connect_delegate); |
| 408 if (headers.get()) { | 408 if (headers.get()) { |
| 409 connect_delegate->OnFinishOpeningHandshake( | 409 connect_delegate->OnFinishOpeningHandshake( |
| 410 base::MakeUnique<WebSocketHandshakeResponseInfo>( | 410 base::MakeUnique<WebSocketHandshakeResponseInfo>( |
| 411 url, headers->response_code(), headers->GetStatusText(), headers, | 411 url, headers->response_code(), headers->GetStatusText(), headers, |
| 412 response_time)); | 412 response_time)); |
| 413 } | 413 } |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace net | 416 } // namespace net |
| OLD | NEW |