Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: net/websockets/websocket_event_interface.h

Issue 12764006: WebSocketChannel implementation (Closed) Base URL: http://git.chromium.org/chromium/src.git@web_socket_dispatcher
Patch Set: Fix "OverFlow" -> "Overflow" Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 // Called in response to an AddChannelRequest. This generally means that a
22 // response has been received from the remote server, but the response might
23 // have been generated internally. If |fail| is true, the channel cannot be
24 // used and it is valid to delete the WebSocketChannel from within this
25 // callback.
26 virtual void OnAddChannelResponse(
27 bool fail,
28 const std::string& selected_subprotocol) = 0;
29
30 // Called when a data frame has been received from the remote host and needs
31 // to be forwarded to the renderer process. It is not safe to delete the
32 // WebSocketChannel object from within this callback.
33 virtual void OnDataFrame(bool fin,
34 WebSocketMessageType type,
35 const std::vector<char>& data) = 0;
36
37 // Called to provide more send quota for this channel to the renderer
38 // process. It is not safe to delete the WebSocketChannel from within this
39 // callback.
40 virtual void OnFlowControl(int64 quota) = 0;
41
42 // Called when the channel has been dropped, either due to a Close message
43 // from the remote host, a network close, a network error, or a protocol
44 // error.
45 //
46 // Warning: Both the |code| and |reason| are passed through to Javascript, so
47 // callers must take care not to provide details that could be useful to
48 // attackers attempting to use WebSockets to probe networks.
49 virtual void OnDropChannel(unsigned short code,
50 const std::string& reason) = 0;
51
52 protected:
53 WebSocketEventInterface() {}
54
55 private:
56 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface);
57 };
58
59 } // namespace net
60
61 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698