| 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_EVENT_INTERFACE_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT | 14 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" |
| 16 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
| 17 | 18 |
| 18 class GURL; | 19 class GURL; |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 23 class IOBuffer; |
| 22 class SSLInfo; | 24 class SSLInfo; |
| 23 struct WebSocketHandshakeRequestInfo; | 25 struct WebSocketHandshakeRequestInfo; |
| 24 struct WebSocketHandshakeResponseInfo; | 26 struct WebSocketHandshakeResponseInfo; |
| 25 | 27 |
| 26 // Interface for events sent from the network layer to the content layer. These | 28 // Interface for events sent from the network layer to the content layer. These |
| 27 // events will generally be sent as-is to the renderer process. | 29 // events will generally be sent as-is to the renderer process. |
| 28 class NET_EXPORT WebSocketEventInterface { | 30 class NET_EXPORT WebSocketEventInterface { |
| 29 public: | 31 public: |
| 30 typedef int WebSocketMessageType; | 32 typedef int WebSocketMessageType; |
| 31 | 33 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 43 // been received from the remote server. | 45 // been received from the remote server. |
| 44 virtual ChannelState OnAddChannelResponse( | 46 virtual ChannelState OnAddChannelResponse( |
| 45 const std::string& selected_subprotocol, | 47 const std::string& selected_subprotocol, |
| 46 const std::string& extensions) WARN_UNUSED_RESULT = 0; | 48 const std::string& extensions) WARN_UNUSED_RESULT = 0; |
| 47 | 49 |
| 48 // Called when a data frame has been received from the remote host and needs | 50 // Called when a data frame has been received from the remote host and needs |
| 49 // to be forwarded to the renderer process. | 51 // to be forwarded to the renderer process. |
| 50 virtual ChannelState OnDataFrame( | 52 virtual ChannelState OnDataFrame( |
| 51 bool fin, | 53 bool fin, |
| 52 WebSocketMessageType type, | 54 WebSocketMessageType type, |
| 53 const std::vector<char>& data) WARN_UNUSED_RESULT = 0; | 55 scoped_refptr<IOBuffer> buffer, |
| 56 size_t buffer_size) WARN_UNUSED_RESULT = 0; |
| 54 | 57 |
| 55 // Called to provide more send quota for this channel to the renderer | 58 // Called to provide more send quota for this channel to the renderer |
| 56 // process. Currently the quota units are always bytes of message body | 59 // process. Currently the quota units are always bytes of message body |
| 57 // data. In future it might depend on the type of multiplexing in use. | 60 // data. In future it might depend on the type of multiplexing in use. |
| 58 virtual ChannelState OnFlowControl(int64_t quota) WARN_UNUSED_RESULT = 0; | 61 virtual ChannelState OnFlowControl(int64_t quota) WARN_UNUSED_RESULT = 0; |
| 59 | 62 |
| 60 // Called when the remote server has Started the WebSocket Closing | 63 // Called when the remote server has Started the WebSocket Closing |
| 61 // Handshake. The client should not attempt to send any more messages after | 64 // Handshake. The client should not attempt to send any more messages after |
| 62 // receiving this message. It will be followed by OnDropChannel() when the | 65 // receiving this message. It will be followed by OnDropChannel() when the |
| 63 // closing handshake is complete. | 66 // closing handshake is complete. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 protected: | 135 protected: |
| 133 WebSocketEventInterface() {} | 136 WebSocketEventInterface() {} |
| 134 | 137 |
| 135 private: | 138 private: |
| 136 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); | 139 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); |
| 137 }; | 140 }; |
| 138 | 141 |
| 139 } // namespace net | 142 } // namespace net |
| 140 | 143 |
| 141 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 144 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| OLD | NEW |