| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
| 17 #include "net/websockets/websocket_event_interface.h" |
| 17 #include "net/websockets/websocket_handshake_request_info.h" | 18 #include "net/websockets/websocket_handshake_request_info.h" |
| 18 #include "net/websockets/websocket_handshake_response_info.h" | 19 #include "net/websockets/websocket_handshake_response_info.h" |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 | 22 |
| 22 namespace url { | 23 namespace url { |
| 23 class Origin; | 24 class Origin; |
| 24 } // namespace url | 25 } // namespace url |
| 25 | 26 |
| 26 namespace net { | 27 namespace net { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // |message| contains defails of the failure. | 68 // |message| contains defails of the failure. |
| 68 virtual void OnFailure(const std::string& message) = 0; | 69 virtual void OnFailure(const std::string& message) = 0; |
| 69 | 70 |
| 70 // Called when the WebSocket Opening Handshake starts. | 71 // Called when the WebSocket Opening Handshake starts. |
| 71 virtual void OnStartOpeningHandshake( | 72 virtual void OnStartOpeningHandshake( |
| 72 scoped_ptr<WebSocketHandshakeRequestInfo> request) = 0; | 73 scoped_ptr<WebSocketHandshakeRequestInfo> request) = 0; |
| 73 | 74 |
| 74 // Called when the WebSocket Opening Handshake ends. | 75 // Called when the WebSocket Opening Handshake ends. |
| 75 virtual void OnFinishOpeningHandshake( | 76 virtual void OnFinishOpeningHandshake( |
| 76 scoped_ptr<WebSocketHandshakeResponseInfo> response) = 0; | 77 scoped_ptr<WebSocketHandshakeResponseInfo> response) = 0; |
| 78 |
| 79 // Called when there is an SSL certificate error. Should call |
| 80 // ssl_error_callbacks->ContinueSSLRequest() or |
| 81 // ssl_error_callbacks->CancelSSLRequest(). |
| 82 virtual void OnSSLCertificateError( |
| 83 scoped_ptr<WebSocketEventInterface::SSLErrorCallbacks> |
| 84 ssl_error_callbacks, |
| 85 const SSLInfo& ssl_info, |
| 86 bool fatal) = 0; |
| 77 }; | 87 }; |
| 78 | 88 |
| 79 // Create and connect a WebSocketStream of an appropriate type. The actual | 89 // Create and connect a WebSocketStream of an appropriate type. The actual |
| 80 // concrete type returned depends on whether multiplexing or SPDY are being | 90 // concrete type returned depends on whether multiplexing or SPDY are being |
| 81 // used to communicate with the remote server. If the handshake completed | 91 // used to communicate with the remote server. If the handshake completed |
| 82 // successfully, then connect_delegate->OnSuccess() is called with a | 92 // successfully, then connect_delegate->OnSuccess() is called with a |
| 83 // WebSocketStream instance. If it failed, then connect_delegate->OnFailure() | 93 // WebSocketStream instance. If it failed, then connect_delegate->OnFailure() |
| 84 // is called with a WebSocket result code corresponding to the error. Deleting | 94 // is called with a WebSocket result code corresponding to the error. Deleting |
| 85 // the returned WebSocketStreamRequest object will cancel the connection, in | 95 // the returned WebSocketStreamRequest object will cancel the connection, in |
| 86 // which case the |connect_delegate| object that the caller passed will be | 96 // which case the |connect_delegate| object that the caller passed will be |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 protected: | 194 protected: |
| 185 WebSocketStream(); | 195 WebSocketStream(); |
| 186 | 196 |
| 187 private: | 197 private: |
| 188 DISALLOW_COPY_AND_ASSIGN(WebSocketStream); | 198 DISALLOW_COPY_AND_ASSIGN(WebSocketStream); |
| 189 }; | 199 }; |
| 190 | 200 |
| 191 } // namespace net | 201 } // namespace net |
| 192 | 202 |
| 193 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ | 203 #endif // NET_WEBSOCKETS_WEBSOCKET_STREAM_H_ |
| OLD | NEW |