OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | |
6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 | |
13 namespace net { | |
14 | |
15 // Interface for events sent from the network layer to the content layer. These | |
16 // events will generally be sent as-is to the renderer process. | |
17 class NET_EXPORT WebSocketEventInterface { | |
18 public: | |
19 typedef int WebSocketMessageType; | |
20 virtual ~WebSocketEventInterface() {} | |
21 // Provides the response to an AddChannelRequest. | |
22 virtual void OnAddChannelResponse(bool fail, | |
23 const std::string& selected_protocol) = 0; | |
24 // A data frame has been received from the remote host and needs to be | |
25 // forwarded to the renderer process. | |
26 virtual void OnDataFrame(bool fin, | |
27 WebSocketMessageType type, | |
28 const std::vector<char>& data) = 0; | |
29 // Provide more send quota to the renderer process. | |
tyoshino (SeeGerritForStatus)
2013/07/01 08:53:32
As these methods are named like OnBlahBlah, it loo
Adam Rice
2013/07/01 10:08:14
Updated. PTAL.
| |
30 virtual void OnFlowControl(int64 quota) = 0; | |
31 // Report that the channel has been dropped, either due to a Close message | |
32 // from the remote host, a network close, a network error, or a protocol | |
33 // error. Both the |code| and |reason| are passed through to Javascript, so | |
34 // care must be taken not to provide details that could be useful to attackers | |
35 // attempting to use WebSockets to probe networks. | |
36 virtual void OnDropChannel(unsigned short code, | |
37 const std::string& reason) = 0; | |
38 | |
39 protected: | |
40 WebSocketEventInterface() {} | |
41 | |
42 private: | |
43 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); | |
44 }; | |
45 | |
46 } // namespace net | |
47 | |
48 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ | |
OLD | NEW |