Chromium Code Reviews| Index: net/websockets/websocket_event_interface.h |
| diff --git a/net/websockets/websocket_event_interface.h b/net/websockets/websocket_event_interface.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4122ab4d1080190ed185c3c4872dfe938713c942 |
| --- /dev/null |
| +++ b/net/websockets/websocket_event_interface.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| +#define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| + |
| +namespace net { |
| + |
| +// Interface for events sent from the network layer to the content layer. These |
| +// events will generally be sent as-is to the renderer process. |
| +class NET_EXPORT WebSocketEventInterface { |
| + public: |
| + typedef int WebSocketMessageType; |
| + virtual ~WebSocketEventInterface() {} |
| + // Provides the response to an AddChannelRequest. |
| + virtual void OnAddChannelResponse(bool fail, |
| + const std::string& selected_protocol) = 0; |
| + // A data frame has been received from the remote host and needs to be |
| + // forwarded to the renderer process. |
| + virtual void OnDataFrame(bool fin, |
| + WebSocketMessageType type, |
| + const std::vector<char>& data) = 0; |
| + // 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.
|
| + virtual void OnFlowControl(int64 quota) = 0; |
| + // Report that the channel has been dropped, either due to a Close message |
| + // from the remote host, a network close, a network error, or a protocol |
| + // error. Both the |code| and |reason| are passed through to Javascript, so |
| + // care must be taken not to provide details that could be useful to attackers |
| + // attempting to use WebSockets to probe networks. |
| + virtual void OnDropChannel(unsigned short code, |
| + const std::string& reason) = 0; |
| + |
| + protected: |
| + WebSocketEventInterface() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ |