| 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 14 matching lines...) Expand all Loading... |
| 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 NetLogWithSource; | 34 class NetLogWithSource; |
| 35 class URLRequest; |
| 35 class URLRequestContext; | 36 class URLRequestContext; |
| 36 struct WebSocketFrame; | 37 struct WebSocketFrame; |
| 37 class WebSocketHandshakeStreamBase; | 38 class WebSocketHandshakeStreamBase; |
| 38 class WebSocketHandshakeStreamCreateHelper; | 39 class WebSocketHandshakeStreamCreateHelper; |
| 39 | 40 |
| 40 // WebSocketStreamRequest is the caller's handle to the process of creation of a | 41 // WebSocketStreamRequest is the caller's handle to the process of creation of a |
| 41 // WebSocketStream. Deleting the object before the OnSuccess or OnFailure | 42 // WebSocketStream. Deleting the object before the OnSuccess or OnFailure |
| 42 // callbacks are called will cancel the request (and neither callback will be | 43 // 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 | 44 // called). After OnSuccess or OnFailure have been called, this object may be |
| 44 // safely deleted without side-effects. | 45 // safely deleted without side-effects. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 64 // |callback| will be called when the operation is finished. Non-null |callback| | 65 // |callback| will be called when the operation is finished. Non-null |callback| |
| 65 // must be provided to these functions. | 66 // must be provided to these functions. |
| 66 | 67 |
| 67 class NET_EXPORT_PRIVATE WebSocketStream { | 68 class NET_EXPORT_PRIVATE WebSocketStream { |
| 68 public: | 69 public: |
| 69 // A concrete object derived from ConnectDelegate is supplied by the caller to | 70 // A concrete object derived from ConnectDelegate is supplied by the caller to |
| 70 // CreateAndConnectStream() to receive the result of the connection. | 71 // CreateAndConnectStream() to receive the result of the connection. |
| 71 class NET_EXPORT_PRIVATE ConnectDelegate { | 72 class NET_EXPORT_PRIVATE ConnectDelegate { |
| 72 public: | 73 public: |
| 73 virtual ~ConnectDelegate(); | 74 virtual ~ConnectDelegate(); |
| 75 // Called when the URLRequest is created. |
| 76 virtual void OnCreateRequest(URLRequest* url_request) = 0; |
| 77 |
| 74 // Called on successful connection. The parameter is an object derived from | 78 // Called on successful connection. The parameter is an object derived from |
| 75 // WebSocketStream. | 79 // WebSocketStream. |
| 76 virtual void OnSuccess(std::unique_ptr<WebSocketStream> stream) = 0; | 80 virtual void OnSuccess(std::unique_ptr<WebSocketStream> stream) = 0; |
| 77 | 81 |
| 78 // Called on failure to connect. | 82 // Called on failure to connect. |
| 79 // |message| contains defails of the failure. | 83 // |message| contains defails of the failure. |
| 80 virtual void OnFailure(const std::string& message) = 0; | 84 virtual void OnFailure(const std::string& message) = 0; |
| 81 | 85 |
| 82 // Called when the WebSocket Opening Handshake starts. | 86 // Called when the WebSocket Opening Handshake starts. |
| 83 virtual void OnStartOpeningHandshake( | 87 virtual void OnStartOpeningHandshake( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // supplied |connect_delegate|. | 235 // supplied |connect_delegate|. |
| 232 void WebSocketDispatchOnFinishOpeningHandshake( | 236 void WebSocketDispatchOnFinishOpeningHandshake( |
| 233 WebSocketStream::ConnectDelegate* connect_delegate, | 237 WebSocketStream::ConnectDelegate* connect_delegate, |
| 234 const GURL& gurl, | 238 const GURL& gurl, |
| 235 const scoped_refptr<HttpResponseHeaders>& headers, | 239 const scoped_refptr<HttpResponseHeaders>& headers, |
| 236 base::Time response_time); | 240 base::Time response_time); |
| 237 | 241 |
| 238 } // namespace net | 242 } // namespace net |
| 239 | 243 |
| 240 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 244 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| OLD | NEW |