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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 frames_.push_back(frame.release()); | 146 frames_.push_back(frame.release()); |
147 } | 147 } |
148 | 148 |
149 // Implementation of WebSocketStream::ConnectDelegate that simply forwards the | 149 // Implementation of WebSocketStream::ConnectDelegate that simply forwards the |
150 // calls on to the WebSocketChannel that created it. | 150 // calls on to the WebSocketChannel that created it. |
151 class WebSocketChannel::ConnectDelegate | 151 class WebSocketChannel::ConnectDelegate |
152 : public WebSocketStream::ConnectDelegate { | 152 : public WebSocketStream::ConnectDelegate { |
153 public: | 153 public: |
154 explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} | 154 explicit ConnectDelegate(WebSocketChannel* creator) : creator_(creator) {} |
155 | 155 |
156 virtual void OnSuccess(scoped_ptr<WebSocketStream> stream) override { | 156 void OnSuccess(scoped_ptr<WebSocketStream> stream) override { |
157 creator_->OnConnectSuccess(stream.Pass()); | 157 creator_->OnConnectSuccess(stream.Pass()); |
158 // |this| may have been deleted. | 158 // |this| may have been deleted. |
159 } | 159 } |
160 | 160 |
161 virtual void OnFailure(const std::string& message) override { | 161 void OnFailure(const std::string& message) override { |
162 creator_->OnConnectFailure(message); | 162 creator_->OnConnectFailure(message); |
163 // |this| has been deleted. | 163 // |this| has been deleted. |
164 } | 164 } |
165 | 165 |
166 virtual void OnStartOpeningHandshake( | 166 void OnStartOpeningHandshake( |
167 scoped_ptr<WebSocketHandshakeRequestInfo> request) override { | 167 scoped_ptr<WebSocketHandshakeRequestInfo> request) override { |
168 creator_->OnStartOpeningHandshake(request.Pass()); | 168 creator_->OnStartOpeningHandshake(request.Pass()); |
169 } | 169 } |
170 | 170 |
171 virtual void OnFinishOpeningHandshake( | 171 void OnFinishOpeningHandshake( |
172 scoped_ptr<WebSocketHandshakeResponseInfo> response) override { | 172 scoped_ptr<WebSocketHandshakeResponseInfo> response) override { |
173 creator_->OnFinishOpeningHandshake(response.Pass()); | 173 creator_->OnFinishOpeningHandshake(response.Pass()); |
174 } | 174 } |
175 | 175 |
176 virtual void OnSSLCertificateError( | 176 void OnSSLCertificateError( |
177 scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> | 177 scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> |
178 ssl_error_callbacks, | 178 ssl_error_callbacks, |
179 const SSLInfo& ssl_info, | 179 const SSLInfo& ssl_info, |
180 bool fatal) override { | 180 bool fatal) override { |
181 creator_->OnSSLCertificateError( | 181 creator_->OnSSLCertificateError( |
182 ssl_error_callbacks.Pass(), ssl_info, fatal); | 182 ssl_error_callbacks.Pass(), ssl_info, fatal); |
183 } | 183 } |
184 | 184 |
185 private: | 185 private: |
186 // A pointer to the WebSocketChannel that created this object. There is no | 186 // A pointer to the WebSocketChannel that created this object. There is no |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 } | 1100 } |
1101 | 1101 |
1102 void WebSocketChannel::CloseTimeout() { | 1102 void WebSocketChannel::CloseTimeout() { |
1103 stream_->Close(); | 1103 stream_->Close(); |
1104 SetState(CLOSED); | 1104 SetState(CLOSED); |
1105 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); | 1105 DoDropChannel(false, kWebSocketErrorAbnormalClosure, ""); |
1106 // |this| has been deleted. | 1106 // |this| has been deleted. |
1107 } | 1107 } |
1108 | 1108 |
1109 } // namespace net | 1109 } // namespace net |
OLD | NEW |