| 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 <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT | 13 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT |
| 13 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 14 | 15 |
| 15 class GURL; | 16 class GURL; |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 45 // Called when a data frame has been received from the remote host and needs | 46 // Called when a data frame has been received from the remote host and needs |
| 46 // to be forwarded to the renderer process. | 47 // to be forwarded to the renderer process. |
| 47 virtual ChannelState OnDataFrame( | 48 virtual ChannelState OnDataFrame( |
| 48 bool fin, | 49 bool fin, |
| 49 WebSocketMessageType type, | 50 WebSocketMessageType type, |
| 50 const std::vector<char>& data) WARN_UNUSED_RESULT = 0; | 51 const std::vector<char>& data) WARN_UNUSED_RESULT = 0; |
| 51 | 52 |
| 52 // Called to provide more send quota for this channel to the renderer | 53 // Called to provide more send quota for this channel to the renderer |
| 53 // process. Currently the quota units are always bytes of message body | 54 // process. Currently the quota units are always bytes of message body |
| 54 // data. In future it might depend on the type of multiplexing in use. | 55 // data. In future it might depend on the type of multiplexing in use. |
| 55 virtual ChannelState OnFlowControl(int64 quota) WARN_UNUSED_RESULT = 0; | 56 virtual ChannelState OnFlowControl(int64_t quota) WARN_UNUSED_RESULT = 0; |
| 56 | 57 |
| 57 // Called when the remote server has Started the WebSocket Closing | 58 // Called when the remote server has Started the WebSocket Closing |
| 58 // Handshake. The client should not attempt to send any more messages after | 59 // Handshake. The client should not attempt to send any more messages after |
| 59 // receiving this message. It will be followed by OnDropChannel() when the | 60 // receiving this message. It will be followed by OnDropChannel() when the |
| 60 // closing handshake is complete. | 61 // closing handshake is complete. |
| 61 virtual ChannelState OnClosingHandshake() WARN_UNUSED_RESULT = 0; | 62 virtual ChannelState OnClosingHandshake() WARN_UNUSED_RESULT = 0; |
| 62 | 63 |
| 63 // Called when the channel has been dropped, either due to a network close, a | 64 // Called when the channel has been dropped, either due to a network close, a |
| 64 // network error, or a protocol error. This may or may not be preceeded by a | 65 // network error, or a protocol error. This may or may not be preceeded by a |
| 65 // call to OnClosingHandshake(). | 66 // call to OnClosingHandshake(). |
| 66 // | 67 // |
| 67 // Warning: Both the |code| and |reason| are passed through to Javascript, so | 68 // Warning: Both the |code| and |reason| are passed through to Javascript, so |
| 68 // callers must take care not to provide details that could be useful to | 69 // callers must take care not to provide details that could be useful to |
| 69 // attackers attempting to use WebSockets to probe networks. | 70 // attackers attempting to use WebSockets to probe networks. |
| 70 // | 71 // |
| 71 // |was_clean| should be true if the closing handshake completed successfully. | 72 // |was_clean| should be true if the closing handshake completed successfully. |
| 72 // | 73 // |
| 73 // The channel should not be used again after OnDropChannel() has been | 74 // The channel should not be used again after OnDropChannel() has been |
| 74 // called. | 75 // called. |
| 75 // | 76 // |
| 76 // This method returns a ChannelState for consistency, but all implementations | 77 // This method returns a ChannelState for consistency, but all implementations |
| 77 // must delete the Channel and return CHANNEL_DELETED. | 78 // must delete the Channel and return CHANNEL_DELETED. |
| 78 virtual ChannelState OnDropChannel(bool was_clean, | 79 virtual ChannelState OnDropChannel(bool was_clean, |
| 79 uint16 code, | 80 uint16_t code, |
| 80 const std::string& reason) | 81 const std::string& reason) |
| 81 WARN_UNUSED_RESULT = 0; | 82 WARN_UNUSED_RESULT = 0; |
| 82 | 83 |
| 83 // Called when the browser fails the channel, as specified in the spec. | 84 // Called when the browser fails the channel, as specified in the spec. |
| 84 // | 85 // |
| 85 // The channel should not be used again after OnFailChannel() has been | 86 // The channel should not be used again after OnFailChannel() has been |
| 86 // called. | 87 // called. |
| 87 // | 88 // |
| 88 // This method returns a ChannelState for consistency, but all implementations | 89 // This method returns a ChannelState for consistency, but all implementations |
| 89 // must delete the Channel and return CHANNEL_DELETED. | 90 // must delete the Channel and return CHANNEL_DELETED. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 protected: | 129 protected: |
| 129 WebSocketEventInterface() {} | 130 WebSocketEventInterface() {} |
| 130 | 131 |
| 131 private: | 132 private: |
| 132 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); | 133 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); |
| 133 }; | 134 }; |
| 134 | 135 |
| 135 } // namespace net | 136 } // namespace net |
| 136 | 137 |
| 137 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 138 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| OLD | NEW |