| 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_BASIC_HANDSHAKE_STREAM_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 std::vector<std::string> requested_sub_protocols, | 35 std::vector<std::string> requested_sub_protocols, |
| 36 std::vector<std::string> requested_extensions, | 36 std::vector<std::string> requested_extensions, |
| 37 std::string* failure_message); | 37 std::string* failure_message); |
| 38 | 38 |
| 39 virtual ~WebSocketBasicHandshakeStream(); | 39 virtual ~WebSocketBasicHandshakeStream(); |
| 40 | 40 |
| 41 // HttpStreamBase methods | 41 // HttpStreamBase methods |
| 42 virtual int InitializeStream(const HttpRequestInfo* request_info, | 42 virtual int InitializeStream(const HttpRequestInfo* request_info, |
| 43 RequestPriority priority, | 43 RequestPriority priority, |
| 44 const BoundNetLog& net_log, | 44 const BoundNetLog& net_log, |
| 45 const CompletionCallback& callback) OVERRIDE; | 45 const CompletionCallback& callback) override; |
| 46 virtual int SendRequest(const HttpRequestHeaders& request_headers, | 46 virtual int SendRequest(const HttpRequestHeaders& request_headers, |
| 47 HttpResponseInfo* response, | 47 HttpResponseInfo* response, |
| 48 const CompletionCallback& callback) OVERRIDE; | 48 const CompletionCallback& callback) override; |
| 49 virtual int ReadResponseHeaders(const CompletionCallback& callback) OVERRIDE; | 49 virtual int ReadResponseHeaders(const CompletionCallback& callback) override; |
| 50 virtual int ReadResponseBody(IOBuffer* buf, | 50 virtual int ReadResponseBody(IOBuffer* buf, |
| 51 int buf_len, | 51 int buf_len, |
| 52 const CompletionCallback& callback) OVERRIDE; | 52 const CompletionCallback& callback) override; |
| 53 virtual void Close(bool not_reusable) OVERRIDE; | 53 virtual void Close(bool not_reusable) override; |
| 54 virtual bool IsResponseBodyComplete() const OVERRIDE; | 54 virtual bool IsResponseBodyComplete() const override; |
| 55 virtual bool CanFindEndOfResponse() const OVERRIDE; | 55 virtual bool CanFindEndOfResponse() const override; |
| 56 virtual bool IsConnectionReused() const OVERRIDE; | 56 virtual bool IsConnectionReused() const override; |
| 57 virtual void SetConnectionReused() OVERRIDE; | 57 virtual void SetConnectionReused() override; |
| 58 virtual bool IsConnectionReusable() const OVERRIDE; | 58 virtual bool IsConnectionReusable() const override; |
| 59 virtual int64 GetTotalReceivedBytes() const OVERRIDE; | 59 virtual int64 GetTotalReceivedBytes() const override; |
| 60 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const | 60 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const |
| 61 OVERRIDE; | 61 override; |
| 62 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 62 virtual void GetSSLInfo(SSLInfo* ssl_info) override; |
| 63 virtual void GetSSLCertRequestInfo( | 63 virtual void GetSSLCertRequestInfo( |
| 64 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 64 SSLCertRequestInfo* cert_request_info) override; |
| 65 virtual bool IsSpdyHttpStream() const OVERRIDE; | 65 virtual bool IsSpdyHttpStream() const override; |
| 66 virtual void Drain(HttpNetworkSession* session) OVERRIDE; | 66 virtual void Drain(HttpNetworkSession* session) override; |
| 67 virtual void SetPriority(RequestPriority priority) OVERRIDE; | 67 virtual void SetPriority(RequestPriority priority) override; |
| 68 | 68 |
| 69 // This is called from the top level once correct handshake response headers | 69 // This is called from the top level once correct handshake response headers |
| 70 // have been received. It creates an appropriate subclass of WebSocketStream | 70 // have been received. It creates an appropriate subclass of WebSocketStream |
| 71 // depending on what extensions were negotiated. This object is unusable after | 71 // depending on what extensions were negotiated. This object is unusable after |
| 72 // Upgrade() has been called and should be disposed of as soon as possible. | 72 // Upgrade() has been called and should be disposed of as soon as possible. |
| 73 virtual scoped_ptr<WebSocketStream> Upgrade() OVERRIDE; | 73 virtual scoped_ptr<WebSocketStream> Upgrade() override; |
| 74 | 74 |
| 75 // Set the value used for the next Sec-WebSocket-Key header | 75 // Set the value used for the next Sec-WebSocket-Key header |
| 76 // deterministically. The key is only used once, and then discarded. | 76 // deterministically. The key is only used once, and then discarded. |
| 77 // For tests only. | 77 // For tests only. |
| 78 void SetWebSocketKeyForTesting(const std::string& key); | 78 void SetWebSocketKeyForTesting(const std::string& key); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // A wrapper for the ReadResponseHeaders callback that checks whether or not | 81 // A wrapper for the ReadResponseHeaders callback that checks whether or not |
| 82 // the connection has been accepted. | 82 // the connection has been accepted. |
| 83 void ReadResponseHeadersCallback(const CompletionCallback& callback, | 83 void ReadResponseHeadersCallback(const CompletionCallback& callback, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 scoped_ptr<WebSocketExtensionParams> extension_params_; | 133 scoped_ptr<WebSocketExtensionParams> extension_params_; |
| 134 | 134 |
| 135 std::string* failure_message_; | 135 std::string* failure_message_; |
| 136 | 136 |
| 137 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); | 137 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 } // namespace net | 140 } // namespace net |
| 141 | 141 |
| 142 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ | 142 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ |
| OLD | NEW |