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

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: Code refactoring and cleanup. 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 #include "net/base/net_export.h"
13
14 namespace net {
15
16 // Interface for events sent from the network layer to the content layer. These
17 // events will generally be sent as-is to the renderer process.
18 class NET_EXPORT WebSocketEventInterface {
19 public:
20 typedef int WebSocketMessageType;
21 virtual ~WebSocketEventInterface() {}
22 // Called in response to an AddChannelRequest. This generally means that a
23 // response has been received from the remote server, but the response might
24 // have been generated internally. If |fail| is true, the channel cannot be
25 // used and it is valid to delete the WebSocketChannel from within this
26 // callback.
27 virtual void OnAddChannelResponse(
28 bool fail,
29 const std::string& selected_subprotocol) = 0;
30
31 // Called when a data frame has been received from the remote host and needs
32 // to be forwarded to the renderer process. It is not safe to delete the
33 // WebSocketChannel object from within this callback.
34 virtual void OnDataFrame(bool fin,
35 WebSocketMessageType type,
36 const std::vector<char>& data) = 0;
37
38 // Called to provide more send quota for this channel to the renderer
39 // process. It is not safe to delete the WebSocketChannel from within this
40 // callback.
41 virtual void OnFlowControl(int64 quota) = 0;
42
43 // Called when the channel has been dropped, either due to a Close message
44 // from the remote host, a network close, a network error, or a protocol
45 // error.
46 //
47 // Warning: Both the |code| and |reason| are passed through to Javascript, so
48 // callers must take care not to provide details that could be useful to
49 // attackers attempting to use WebSockets to probe networks.
50 virtual void OnDropChannel(uint16 code,
51 const std::string& reason) = 0;
52
53 protected:
54 WebSocketEventInterface() {}
55
56 private:
57 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface);
58 };
59
60 } // namespace net
61
62 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698