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 18 matching lines...) Expand all Loading... |
29 public: | 29 public: |
30 // |connect_delegate| and |failure_message| must out-live this object. | 30 // |connect_delegate| and |failure_message| must out-live this object. |
31 WebSocketBasicHandshakeStream( | 31 WebSocketBasicHandshakeStream( |
32 scoped_ptr<ClientSocketHandle> connection, | 32 scoped_ptr<ClientSocketHandle> connection, |
33 WebSocketStream::ConnectDelegate* connect_delegate, | 33 WebSocketStream::ConnectDelegate* connect_delegate, |
34 bool using_proxy, | 34 bool using_proxy, |
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 ~WebSocketBasicHandshakeStream() override; |
40 | 40 |
41 // HttpStreamBase methods | 41 // HttpStreamBase methods |
42 virtual int InitializeStream(const HttpRequestInfo* request_info, | 42 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 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 int ReadResponseHeaders(const CompletionCallback& callback) override; |
50 virtual int ReadResponseBody(IOBuffer* buf, | 50 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 void Close(bool not_reusable) override; |
54 virtual bool IsResponseBodyComplete() const override; | 54 bool IsResponseBodyComplete() const override; |
55 virtual bool CanFindEndOfResponse() const override; | 55 bool CanFindEndOfResponse() const override; |
56 virtual bool IsConnectionReused() const override; | 56 bool IsConnectionReused() const override; |
57 virtual void SetConnectionReused() override; | 57 void SetConnectionReused() override; |
58 virtual bool IsConnectionReusable() const override; | 58 bool IsConnectionReusable() const override; |
59 virtual int64 GetTotalReceivedBytes() const override; | 59 int64 GetTotalReceivedBytes() const override; |
60 virtual bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const | 60 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
61 override; | 61 void GetSSLInfo(SSLInfo* ssl_info) override; |
62 virtual void GetSSLInfo(SSLInfo* ssl_info) override; | 62 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
63 virtual void GetSSLCertRequestInfo( | 63 bool IsSpdyHttpStream() const override; |
64 SSLCertRequestInfo* cert_request_info) override; | 64 void Drain(HttpNetworkSession* session) override; |
65 virtual bool IsSpdyHttpStream() const override; | 65 void SetPriority(RequestPriority priority) override; |
66 virtual void Drain(HttpNetworkSession* session) override; | |
67 virtual void SetPriority(RequestPriority priority) override; | |
68 | 66 |
69 // This is called from the top level once correct handshake response headers | 67 // This is called from the top level once correct handshake response headers |
70 // have been received. It creates an appropriate subclass of WebSocketStream | 68 // have been received. It creates an appropriate subclass of WebSocketStream |
71 // depending on what extensions were negotiated. This object is unusable after | 69 // 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. | 70 // Upgrade() has been called and should be disposed of as soon as possible. |
73 virtual scoped_ptr<WebSocketStream> Upgrade() override; | 71 scoped_ptr<WebSocketStream> Upgrade() override; |
74 | 72 |
75 // Set the value used for the next Sec-WebSocket-Key header | 73 // Set the value used for the next Sec-WebSocket-Key header |
76 // deterministically. The key is only used once, and then discarded. | 74 // deterministically. The key is only used once, and then discarded. |
77 // For tests only. | 75 // For tests only. |
78 void SetWebSocketKeyForTesting(const std::string& key); | 76 void SetWebSocketKeyForTesting(const std::string& key); |
79 | 77 |
80 private: | 78 private: |
81 // A wrapper for the ReadResponseHeaders callback that checks whether or not | 79 // A wrapper for the ReadResponseHeaders callback that checks whether or not |
82 // the connection has been accepted. | 80 // the connection has been accepted. |
83 void ReadResponseHeadersCallback(const CompletionCallback& callback, | 81 void ReadResponseHeadersCallback(const CompletionCallback& callback, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 scoped_ptr<WebSocketExtensionParams> extension_params_; | 131 scoped_ptr<WebSocketExtensionParams> extension_params_; |
134 | 132 |
135 std::string* failure_message_; | 133 std::string* failure_message_; |
136 | 134 |
137 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); | 135 DISALLOW_COPY_AND_ASSIGN(WebSocketBasicHandshakeStream); |
138 }; | 136 }; |
139 | 137 |
140 } // namespace net | 138 } // namespace net |
141 | 139 |
142 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ | 140 #endif // NET_WEBSOCKETS_WEBSOCKET_BASIC_HANDSHAKE_STREAM_H_ |
OLD | NEW |