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_channel.h" | 5 #include "net/websockets/websocket_channel.h" |
6 | 6 |
7 #include <limits.h> // for INT_MAX | 7 #include <limits.h> // for INT_MAX |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <deque> | 10 #include <deque> |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 virtual void OnStartOpeningHandshake( | 169 virtual void OnStartOpeningHandshake( |
170 scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { | 170 scoped_ptr<WebSocketHandshakeRequestInfo> request) OVERRIDE { |
171 creator_->OnStartOpeningHandshake(request.Pass()); | 171 creator_->OnStartOpeningHandshake(request.Pass()); |
172 } | 172 } |
173 | 173 |
174 virtual void OnFinishOpeningHandshake( | 174 virtual void OnFinishOpeningHandshake( |
175 scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { | 175 scoped_ptr<WebSocketHandshakeResponseInfo> response) OVERRIDE { |
176 creator_->OnFinishOpeningHandshake(response.Pass()); | 176 creator_->OnFinishOpeningHandshake(response.Pass()); |
177 } | 177 } |
178 | 178 |
| 179 virtual void OnSSLCertificateError( |
| 180 scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> |
| 181 ssl_error_callbacks, |
| 182 const SSLInfo& ssl_info, |
| 183 bool fatal) OVERRIDE { |
| 184 creator_->OnSSLCertificateError( |
| 185 ssl_error_callbacks.Pass(), ssl_info, fatal); |
| 186 } |
| 187 |
179 private: | 188 private: |
180 // A pointer to the WebSocketChannel that created this object. There is no | 189 // A pointer to the WebSocketChannel that created this object. There is no |
181 // danger of this pointer being stale, because deleting the WebSocketChannel | 190 // danger of this pointer being stale, because deleting the WebSocketChannel |
182 // cancels the connect process, deleting this object and preventing its | 191 // cancels the connect process, deleting this object and preventing its |
183 // callbacks from being called. | 192 // callbacks from being called. |
184 WebSocketChannel* const creator_; | 193 WebSocketChannel* const creator_; |
185 | 194 |
186 DISALLOW_COPY_AND_ASSIGN(ConnectDelegate); | 195 DISALLOW_COPY_AND_ASSIGN(ConnectDelegate); |
187 }; | 196 }; |
188 | 197 |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 578 |
570 if (CHANNEL_DELETED == | 579 if (CHANNEL_DELETED == |
571 notification_sender_->SendImmediately(event_interface_.get())) { | 580 notification_sender_->SendImmediately(event_interface_.get())) { |
572 // |this| has been deleted. | 581 // |this| has been deleted. |
573 return; | 582 return; |
574 } | 583 } |
575 AllowUnused(event_interface_->OnFailChannel(message)); | 584 AllowUnused(event_interface_->OnFailChannel(message)); |
576 // |this| has been deleted. | 585 // |this| has been deleted. |
577 } | 586 } |
578 | 587 |
| 588 void WebSocketChannel::OnSSLCertificateError( |
| 589 scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> ssl_error_callbacks, |
| 590 const SSLInfo& ssl_info, |
| 591 bool fatal) { |
| 592 AllowUnused(event_interface_->OnSSLCertificateError( |
| 593 ssl_error_callbacks.Pass(), socket_url_, ssl_info, fatal)); |
| 594 } |
| 595 |
579 void WebSocketChannel::OnStartOpeningHandshake( | 596 void WebSocketChannel::OnStartOpeningHandshake( |
580 scoped_ptr<WebSocketHandshakeRequestInfo> request) { | 597 scoped_ptr<WebSocketHandshakeRequestInfo> request) { |
581 DCHECK(!notification_sender_->handshake_request_info()); | 598 DCHECK(!notification_sender_->handshake_request_info()); |
582 | 599 |
583 // Because it is hard to handle an IPC error synchronously is difficult, | 600 // Because it is hard to handle an IPC error synchronously is difficult, |
584 // we asynchronously notify the information. | 601 // we asynchronously notify the information. |
585 notification_sender_->set_handshake_request_info(request.Pass()); | 602 notification_sender_->set_handshake_request_info(request.Pass()); |
586 ScheduleOpeningHandshakeNotification(); | 603 ScheduleOpeningHandshakeNotification(); |
587 } | 604 } |
588 | 605 |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 } | 1102 } |
1086 | 1103 |
1087 void WebSocketChannel::CloseTimeout() { | 1104 void WebSocketChannel::CloseTimeout() { |
1088 stream_->Close(); | 1105 stream_->Close(); |
1089 SetState(CLOSED); | 1106 SetState(CLOSED); |
1090 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); | 1107 AllowUnused(DoDropChannel(false, kWebSocketErrorAbnormalClosure, "")); |
1091 // |this| has been deleted. | 1108 // |this| has been deleted. |
1092 } | 1109 } |
1093 | 1110 |
1094 } // namespace net | 1111 } // namespace net |
OLD | NEW |