| 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 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 const std::vector<std::string>& requested_protocols, | 146 const std::vector<std::string>& requested_protocols, |
| 147 const GURL& origin, | 147 const GURL& origin, |
| 148 const WebSocketStreamCreator& creator); | 148 const WebSocketStreamCreator& creator); |
| 149 | 149 |
| 150 // Success callback from WebSocketStream::CreateAndConnectStream(). Reports | 150 // Success callback from WebSocketStream::CreateAndConnectStream(). Reports |
| 151 // success to the event interface. May delete |this|. | 151 // success to the event interface. May delete |this|. |
| 152 void OnConnectSuccess(scoped_ptr<WebSocketStream> stream); | 152 void OnConnectSuccess(scoped_ptr<WebSocketStream> stream); |
| 153 | 153 |
| 154 // Failure callback from WebSocketStream::CreateAndConnectStream(). Reports | 154 // Failure callback from WebSocketStream::CreateAndConnectStream(). Reports |
| 155 // failure to the event interface. May delete |this|. | 155 // failure to the event interface. May delete |this|. |
| 156 void OnConnectFailure(uint16 websocket_error); | 156 void OnConnectFailure(const std::string& message); |
| 157 | 157 |
| 158 // Returns true if state_ is SEND_CLOSED, CLOSE_WAIT or CLOSED. | 158 // Returns true if state_ is SEND_CLOSED, CLOSE_WAIT or CLOSED. |
| 159 bool InClosingState() const; | 159 bool InClosingState() const; |
| 160 | 160 |
| 161 // Calls WebSocketStream::WriteFrames() with the appropriate arguments | 161 // Calls WebSocketStream::WriteFrames() with the appropriate arguments |
| 162 ChannelState WriteFrames() WARN_UNUSED_RESULT; | 162 ChannelState WriteFrames() WARN_UNUSED_RESULT; |
| 163 | 163 |
| 164 // Callback from WebSocketStream::WriteFrames. Sends pending data or adjusts | 164 // Callback from WebSocketStream::WriteFrames. Sends pending data or adjusts |
| 165 // the send quota of the renderer channel as appropriate. |result| is a net | 165 // the send quota of the renderer channel as appropriate. |result| is a net |
| 166 // error code, usually OK. If |synchronous| is true, then OnWriteDone() is | 166 // error code, usually OK. If |synchronous| is true, then OnWriteDone() is |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 // The current state of the channel. Mainly used for sanity checking, but also | 286 // The current state of the channel. Mainly used for sanity checking, but also |
| 287 // used to track the close state. | 287 // used to track the close state. |
| 288 State state_; | 288 State state_; |
| 289 | 289 |
| 290 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); | 290 DISALLOW_COPY_AND_ASSIGN(WebSocketChannel); |
| 291 }; | 291 }; |
| 292 | 292 |
| 293 } // namespace net | 293 } // namespace net |
| 294 | 294 |
| 295 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ | 295 #endif // NET_WEBSOCKETS_WEBSOCKET_CHANNEL_H_ |
| OLD | NEW |