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_HANDSHAKE_STREAM_BASE_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ |
6 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ |
7 | 7 |
8 // This file is included from net/http files. | 8 // This file is included from net/http files. |
9 // Since net/http can be built without linking net/websockets code, | 9 // Since net/http can be built without linking net/websockets code, |
10 // this file must not introduce any link-time dependencies on websockets. | 10 // this file must not introduce any link-time dependencies on websockets. |
(...skipping 22 matching lines...) Expand all Loading... |
33 // An object that stores data needed for the creation of a | 33 // An object that stores data needed for the creation of a |
34 // WebSocketBasicHandshakeStream object. A new CreateHelper is used for each | 34 // WebSocketBasicHandshakeStream object. A new CreateHelper is used for each |
35 // WebSocket connection. | 35 // WebSocket connection. |
36 class NET_EXPORT_PRIVATE CreateHelper : public base::SupportsUserData::Data { | 36 class NET_EXPORT_PRIVATE CreateHelper : public base::SupportsUserData::Data { |
37 public: | 37 public: |
38 // Returns a key to use to lookup this object in a URLRequest object. It is | 38 // Returns a key to use to lookup this object in a URLRequest object. It is |
39 // different from any other key that is supplied to | 39 // different from any other key that is supplied to |
40 // URLRequest::SetUserData(). | 40 // URLRequest::SetUserData(). |
41 static const void* DataKey() { return kWebSocketHandshakeUserDataKey; } | 41 static const void* DataKey() { return kWebSocketHandshakeUserDataKey; } |
42 | 42 |
43 virtual ~CreateHelper() {} | 43 ~CreateHelper() override {} |
44 | 44 |
45 // Create a WebSocketBasicHandshakeStream. This is called after the | 45 // Create a WebSocketBasicHandshakeStream. This is called after the |
46 // underlying connection has been established but before any handshake data | 46 // underlying connection has been established but before any handshake data |
47 // has been transferred. This can be called more than once in the case that | 47 // has been transferred. This can be called more than once in the case that |
48 // HTTP authentication is needed. | 48 // HTTP authentication is needed. |
49 virtual WebSocketHandshakeStreamBase* CreateBasicStream( | 49 virtual WebSocketHandshakeStreamBase* CreateBasicStream( |
50 scoped_ptr<ClientSocketHandle> connection, | 50 scoped_ptr<ClientSocketHandle> connection, |
51 bool using_proxy) = 0; | 51 bool using_proxy) = 0; |
52 | 52 |
53 // Create a WebSocketSpdyHandshakeStream (unimplemented as of October 2013) | 53 // Create a WebSocketSpdyHandshakeStream (unimplemented as of October 2013) |
54 virtual WebSocketHandshakeStreamBase* CreateSpdyStream( | 54 virtual WebSocketHandshakeStreamBase* CreateSpdyStream( |
55 const base::WeakPtr<SpdySession>& session, | 55 const base::WeakPtr<SpdySession>& session, |
56 bool use_relative_url) = 0; | 56 bool use_relative_url) = 0; |
57 }; | 57 }; |
58 | 58 |
59 // This has to have an inline implementation so that the net/url_request/ | 59 // This has to have an inline implementation so that the net/url_request/ |
60 // tests do not fail on iOS. | 60 // tests do not fail on iOS. |
61 virtual ~WebSocketHandshakeStreamBase() {} | 61 ~WebSocketHandshakeStreamBase() override {} |
62 | 62 |
63 // After the handshake has completed, this method creates a WebSocketStream | 63 // After the handshake has completed, this method creates a WebSocketStream |
64 // (of the appropriate type) from the WebSocketHandshakeStreamBase object. | 64 // (of the appropriate type) from the WebSocketHandshakeStreamBase object. |
65 // The WebSocketHandshakeStreamBase object is unusable after Upgrade() has | 65 // The WebSocketHandshakeStreamBase object is unusable after Upgrade() has |
66 // been called. | 66 // been called. |
67 virtual scoped_ptr<WebSocketStream> Upgrade() = 0; | 67 virtual scoped_ptr<WebSocketStream> Upgrade() = 0; |
68 | 68 |
69 protected: | 69 protected: |
70 // As with the destructor, this must be inline. | 70 // As with the destructor, this must be inline. |
71 WebSocketHandshakeStreamBase() {} | 71 WebSocketHandshakeStreamBase() {} |
72 | 72 |
73 private: | 73 private: |
74 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamBase); | 74 DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeStreamBase); |
75 }; | 75 }; |
76 | 76 |
77 } // namespace net | 77 } // namespace net |
78 | 78 |
79 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ | 79 #endif // NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_STREAM_BASE_H_ |
OLD | NEW |