| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_STREAM_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // the returned WebSocketStreamRequest object will cancel the connection, in | 101 // the returned WebSocketStreamRequest object will cancel the connection, in |
| 102 // which case the |connect_delegate| object that the caller passed will be | 102 // which case the |connect_delegate| object that the caller passed will be |
| 103 // deleted without any of its methods being called. Unless cancellation is | 103 // deleted without any of its methods being called. Unless cancellation is |
| 104 // required, the caller should keep the WebSocketStreamRequest object alive | 104 // required, the caller should keep the WebSocketStreamRequest object alive |
| 105 // until connect_delegate->OnSuccess() or OnFailure() have been called, then | 105 // until connect_delegate->OnSuccess() or OnFailure() have been called, then |
| 106 // it is safe to delete. | 106 // it is safe to delete. |
| 107 static std::unique_ptr<WebSocketStreamRequest> CreateAndConnectStream( | 107 static std::unique_ptr<WebSocketStreamRequest> CreateAndConnectStream( |
| 108 const GURL& socket_url, | 108 const GURL& socket_url, |
| 109 const std::vector<std::string>& requested_subprotocols, | 109 const std::vector<std::string>& requested_subprotocols, |
| 110 const url::Origin& origin, | 110 const url::Origin& origin, |
| 111 const std::string& additional_headers, |
| 111 URLRequestContext* url_request_context, | 112 URLRequestContext* url_request_context, |
| 112 const BoundNetLog& net_log, | 113 const BoundNetLog& net_log, |
| 113 std::unique_ptr<ConnectDelegate> connect_delegate); | 114 std::unique_ptr<ConnectDelegate> connect_delegate); |
| 114 | 115 |
| 115 // Derived classes must make sure Close() is called when the stream is not | 116 // Derived classes must make sure Close() is called when the stream is not |
| 116 // closed on destruction. | 117 // closed on destruction. |
| 117 virtual ~WebSocketStream(); | 118 virtual ~WebSocketStream(); |
| 118 | 119 |
| 119 // Reads WebSocket frame data. This operation finishes when new frame data | 120 // Reads WebSocket frame data. This operation finishes when new frame data |
| 120 // becomes available. | 121 // becomes available. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 // Alternate version of WebSocketStream::CreateAndConnectStream() for testing | 218 // Alternate version of WebSocketStream::CreateAndConnectStream() for testing |
| 218 // use only. The differences are the use of a |create_helper| argument in place | 219 // use only. The differences are the use of a |create_helper| argument in place |
| 219 // of |requested_subprotocols| and taking |timer| as the handshake timeout | 220 // of |requested_subprotocols| and taking |timer| as the handshake timeout |
| 220 // timer. Implemented in websocket_stream.cc. | 221 // timer. Implemented in websocket_stream.cc. |
| 221 NET_EXPORT_PRIVATE std::unique_ptr<WebSocketStreamRequest> | 222 NET_EXPORT_PRIVATE std::unique_ptr<WebSocketStreamRequest> |
| 222 CreateAndConnectStreamForTesting( | 223 CreateAndConnectStreamForTesting( |
| 223 const GURL& socket_url, | 224 const GURL& socket_url, |
| 224 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, | 225 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, |
| 225 const url::Origin& origin, | 226 const url::Origin& origin, |
| 227 const std::string& additional_headers, |
| 226 URLRequestContext* url_request_context, | 228 URLRequestContext* url_request_context, |
| 227 const BoundNetLog& net_log, | 229 const BoundNetLog& net_log, |
| 228 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate, | 230 std::unique_ptr<WebSocketStream::ConnectDelegate> connect_delegate, |
| 229 std::unique_ptr<base::Timer> timer); | 231 std::unique_ptr<base::Timer> timer); |
| 230 | 232 |
| 231 } // namespace net | 233 } // namespace net |
| 232 | 234 |
| 233 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 235 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| OLD | NEW |