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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 url_request_->SetExtraRequestHeaders(headers); | 109 url_request_->SetExtraRequestHeaders(headers); |
110 url_request_->set_initiator(origin); | 110 url_request_->set_initiator(origin); |
111 url_request_->set_first_party_for_cookies(first_party_for_cookies); | 111 url_request_->set_first_party_for_cookies(first_party_for_cookies); |
112 | 112 |
113 // This passes the ownership of |handshake_stream_create_helper_| to | 113 // This passes the ownership of |handshake_stream_create_helper_| to |
114 // |url_request_|. | 114 // |url_request_|. |
115 url_request_->SetUserData( | 115 url_request_->SetUserData( |
116 WebSocketHandshakeStreamBase::CreateHelper::DataKey(), | 116 WebSocketHandshakeStreamBase::CreateHelper::DataKey(), |
117 handshake_stream_create_helper_); | 117 handshake_stream_create_helper_); |
118 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE); | 118 url_request_->SetLoadFlags(LOAD_DISABLE_CACHE | LOAD_BYPASS_CACHE); |
| 119 connect_delegate_->OnCreateRequest(url_request_.get()); |
119 } | 120 } |
120 | 121 |
121 // Destroying this object destroys the URLRequest, which cancels the request | 122 // Destroying this object destroys the URLRequest, which cancels the request |
122 // and so terminates the handshake if it is incomplete. | 123 // and so terminates the handshake if it is incomplete. |
123 ~WebSocketStreamRequestImpl() override {} | 124 ~WebSocketStreamRequestImpl() override {} |
124 | 125 |
125 void OnHandshakeStreamCreated( | 126 void OnHandshakeStreamCreated( |
126 WebSocketHandshakeStreamBase* handshake_stream) override { | 127 WebSocketHandshakeStreamBase* handshake_stream) override { |
127 handshake_stream_ = handshake_stream; | 128 handshake_stream_ = handshake_stream; |
128 } | 129 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 DCHECK(connect_delegate); | 404 DCHECK(connect_delegate); |
404 if (headers.get()) { | 405 if (headers.get()) { |
405 connect_delegate->OnFinishOpeningHandshake( | 406 connect_delegate->OnFinishOpeningHandshake( |
406 base::MakeUnique<WebSocketHandshakeResponseInfo>( | 407 base::MakeUnique<WebSocketHandshakeResponseInfo>( |
407 url, headers->response_code(), headers->GetStatusText(), headers, | 408 url, headers->response_code(), headers->GetStatusText(), headers, |
408 response_time)); | 409 response_time)); |
409 } | 410 } |
410 } | 411 } |
411 | 412 |
412 } // namespace net | 413 } // namespace net |
OLD | NEW |