| 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 13 matching lines...) Expand all Loading... |
| 24 namespace base { | 24 namespace base { |
| 25 class Timer; | 25 class Timer; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace url { | 28 namespace url { |
| 29 class Origin; | 29 class Origin; |
| 30 } // namespace url | 30 } // namespace url |
| 31 | 31 |
| 32 namespace net { | 32 namespace net { |
| 33 | 33 |
| 34 class BoundNetLog; | 34 class NetLogWithSource; |
| 35 class URLRequestContext; | 35 class URLRequestContext; |
| 36 struct WebSocketFrame; | 36 struct WebSocketFrame; |
| 37 class WebSocketHandshakeStreamBase; | 37 class WebSocketHandshakeStreamBase; |
| 38 class WebSocketHandshakeStreamCreateHelper; | 38 class WebSocketHandshakeStreamCreateHelper; |
| 39 | 39 |
| 40 // WebSocketStreamRequest is the caller's handle to the process of creation of a | 40 // WebSocketStreamRequest is the caller's handle to the process of creation of a |
| 41 // WebSocketStream. Deleting the object before the OnSuccess or OnFailure | 41 // WebSocketStream. Deleting the object before the OnSuccess or OnFailure |
| 42 // callbacks are called will cancel the request (and neither callback will be | 42 // callbacks are called will cancel the request (and neither callback will be |
| 43 // called). After OnSuccess or OnFailure have been called, this object may be | 43 // called). After OnSuccess or OnFailure have been called, this object may be |
| 44 // safely deleted without side-effects. | 44 // safely deleted without side-effects. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // required, the caller should keep the WebSocketStreamRequest object alive | 109 // required, the caller should keep the WebSocketStreamRequest object alive |
| 110 // until connect_delegate->OnSuccess() or OnFailure() have been called, then | 110 // until connect_delegate->OnSuccess() or OnFailure() have been called, then |
| 111 // it is safe to delete. | 111 // it is safe to delete. |
| 112 static std::unique_ptr<WebSocketStreamRequest> CreateAndConnectStream( | 112 static std::unique_ptr<WebSocketStreamRequest> CreateAndConnectStream( |
| 113 const GURL& socket_url, | 113 const GURL& socket_url, |
| 114 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, | 114 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, |
| 115 const url::Origin& origin, | 115 const url::Origin& origin, |
| 116 const GURL& first_party_for_cookies, | 116 const GURL& first_party_for_cookies, |
| 117 const std::string& additional_headers, | 117 const std::string& additional_headers, |
| 118 URLRequestContext* url_request_context, | 118 URLRequestContext* url_request_context, |
| 119 const BoundNetLog& net_log, | 119 const NetLogWithSource& net_log, |
| 120 std::unique_ptr<ConnectDelegate> connect_delegate); | 120 std::unique_ptr<ConnectDelegate> connect_delegate); |
| 121 | 121 |
| 122 // Alternate version of CreateAndConnectStream() for testing use only. It | 122 // Alternate version of CreateAndConnectStream() for testing use only. It |
| 123 // takes |timer| as the handshake timeout timer. | 123 // takes |timer| as the handshake timeout timer. |
| 124 static std::unique_ptr<WebSocketStreamRequest> | 124 static std::unique_ptr<WebSocketStreamRequest> |
| 125 CreateAndConnectStreamForTesting( | 125 CreateAndConnectStreamForTesting( |
| 126 const GURL& socket_url, | 126 const GURL& socket_url, |
| 127 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, | 127 std::unique_ptr<WebSocketHandshakeStreamCreateHelper> create_helper, |
| 128 const url::Origin& origin, | 128 const url::Origin& origin, |
| 129 const GURL& first_party_for_cookies, | 129 const GURL& first_party_for_cookies, |
| 130 const std::string& additional_headers, | 130 const std::string& additional_headers, |
| 131 URLRequestContext* url_request_context, | 131 URLRequestContext* url_request_context, |
| 132 const BoundNetLog& net_log, | 132 const NetLogWithSource& net_log, |
| 133 std::unique_ptr<ConnectDelegate> connect_delegate, | 133 std::unique_ptr<ConnectDelegate> connect_delegate, |
| 134 std::unique_ptr<base::Timer> timer); | 134 std::unique_ptr<base::Timer> timer); |
| 135 | 135 |
| 136 // Derived classes must make sure Close() is called when the stream is not | 136 // Derived classes must make sure Close() is called when the stream is not |
| 137 // closed on destruction. | 137 // closed on destruction. |
| 138 virtual ~WebSocketStream(); | 138 virtual ~WebSocketStream(); |
| 139 | 139 |
| 140 // Reads WebSocket frame data. This operation finishes when new frame data | 140 // Reads WebSocket frame data. This operation finishes when new frame data |
| 141 // becomes available. | 141 // becomes available. |
| 142 // | 142 // |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // supplied |connect_delegate|. | 231 // supplied |connect_delegate|. |
| 232 void WebSocketDispatchOnFinishOpeningHandshake( | 232 void WebSocketDispatchOnFinishOpeningHandshake( |
| 233 WebSocketStream::ConnectDelegate* connect_delegate, | 233 WebSocketStream::ConnectDelegate* connect_delegate, |
| 234 const GURL& gurl, | 234 const GURL& gurl, |
| 235 const scoped_refptr<HttpResponseHeaders>& headers, | 235 const scoped_refptr<HttpResponseHeaders>& headers, |
| 236 base::Time response_time); | 236 base::Time response_time); |
| 237 | 237 |
| 238 } // namespace net | 238 } // namespace net |
| 239 | 239 |
| 240 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 240 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| OLD | NEW |