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 <string> | 10 #include <string> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // | 68 // |
69 // Warning: Both the |code| and |reason| are passed through to Javascript, so | 69 // Warning: Both the |code| and |reason| are passed through to Javascript, so |
70 // callers must take care not to provide details that could be useful to | 70 // callers must take care not to provide details that could be useful to |
71 // attackers attempting to use WebSockets to probe networks. | 71 // attackers attempting to use WebSockets to probe networks. |
72 // | 72 // |
73 // |was_clean| should be true if the closing handshake completed successfully. | 73 // |was_clean| should be true if the closing handshake completed successfully. |
74 // | 74 // |
75 // The channel should not be used again after OnDropChannel() has been | 75 // The channel should not be used again after OnDropChannel() has been |
76 // called. | 76 // called. |
77 // | 77 // |
78 // This method returns a ChannelState for consistency, but all implementations | 78 // Implementations that delete the channel synchronously should return |
79 // must delete the Channel and return CHANNEL_DELETED. | 79 // CHANNEL_DELETED. It is valid to return CHANNEL_ALIVE and delete the |
| 80 // channel after a delay, provided no further calls are made on the channel. |
80 virtual ChannelState OnDropChannel(bool was_clean, | 81 virtual ChannelState OnDropChannel(bool was_clean, |
81 uint16_t code, | 82 uint16_t code, |
82 const std::string& reason) | 83 const std::string& reason) |
83 WARN_UNUSED_RESULT = 0; | 84 WARN_UNUSED_RESULT = 0; |
84 | 85 |
85 // Called when the browser fails the channel, as specified in the spec. | 86 // Called when the browser fails the channel, as specified in the spec. |
86 // | 87 // |
87 // The channel should not be used again after OnFailChannel() has been | 88 // The channel should not be used again after OnFailChannel() has been |
88 // called. | 89 // called. |
89 // | 90 // |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 protected: | 131 protected: |
131 WebSocketEventInterface() {} | 132 WebSocketEventInterface() {} |
132 | 133 |
133 private: | 134 private: |
134 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); | 135 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); |
135 }; | 136 }; |
136 | 137 |
137 } // namespace net | 138 } // namespace net |
138 | 139 |
139 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | 140 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
OLD | NEW |