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 // Multiply-included message file, hence no include guard. | 5 // Multiply-included message file, hence no include guard. |
6 | 6 |
7 // This file defines the IPCs for the browser-side implementation of | 7 // This file defines the IPCs for the browser-side implementation of |
8 // WebSockets. For the legacy renderer-side implementation, see | 8 // WebSockets. For the legacy renderer-side implementation, see |
9 // socket_stream_messages.h. | 9 // socket_stream_messages.h. |
10 // TODO(ricea): Fix this comment when the legacy implementation has been | 10 // TODO(ricea): Fix this comment when the legacy implementation has been |
(...skipping 25 matching lines...) Expand all Loading... |
36 // "Subprotocols Using the WebSocket Protocol". | 36 // "Subprotocols Using the WebSocket Protocol". |
37 // | 37 // |
38 // The browser process will not send |channel_id| as-is to the remote server; it | 38 // The browser process will not send |channel_id| as-is to the remote server; it |
39 // will try to use a short id on the wire. This saves the renderer from | 39 // will try to use a short id on the wire. This saves the renderer from |
40 // having to try to choose the ids cleverly. | 40 // having to try to choose the ids cleverly. |
41 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest, | 41 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest, |
42 GURL /* socket_url */, | 42 GURL /* socket_url */, |
43 std::vector<std::string> /* requested_protocols */, | 43 std::vector<std::string> /* requested_protocols */, |
44 GURL /* origin */) | 44 GURL /* origin */) |
45 | 45 |
46 // Web Socket messages sent from the browser to the renderer. | 46 // WebSocket messages sent from the browser to the renderer. |
47 | 47 |
48 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is | 48 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is |
49 // scoped to the renderer process; while it is unique per-renderer, the browser | 49 // scoped to the renderer process; while it is unique per-renderer, the browser |
50 // may have multiple renderers using the same id. If |fail| is true, the channel | 50 // may have multiple renderers using the same id. If |fail| is true, the channel |
51 // could not be established (the cause of the failure is not provided to the | 51 // could not be established (the cause of the failure is not provided to the |
52 // renderer in order to limit its ability to abuse WebSockets to perform network | 52 // renderer in order to limit its ability to abuse WebSockets to perform network |
53 // probing, etc.). If |fail| is set then the |channel_id| is available for | 53 // probing, etc.). If |fail| is set then the |channel_id| is available for |
54 // re-use. |selected_protocol| is the sub-protocol the server selected, | 54 // re-use. |selected_protocol| is the sub-protocol the server selected, |
55 // or empty if no sub-protocol was selected. |extensions| is the list of | 55 // or empty if no sub-protocol was selected. |extensions| is the list of |
56 // extensions negotiated for the connection. | 56 // extensions negotiated for the connection. |
57 IPC_MESSAGE_ROUTED3(WebSocketMsg_AddChannelResponse, | 57 IPC_MESSAGE_ROUTED3(WebSocketMsg_AddChannelResponse, |
58 bool /* fail */, | 58 bool /* fail */, |
59 std::string /* selected_protocol */, | 59 std::string /* selected_protocol */, |
60 std::string /* extensions */) | 60 std::string /* extensions */) |
61 | 61 |
| 62 // Notify the renderer that the browser is required to fail the connection. |
| 63 // This message will be followed by a corresponding DropChannel message and |
| 64 // hence the renderer should NOT drop the channel when it receives this |
| 65 // message. |
| 66 // |message| will be shown in the inspector and won't be passed to the |
| 67 // script. |
| 68 // TODO(yhirano): Find the way to pass |message| directly to the inspector |
| 69 // process. |
| 70 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, |
| 71 std::string /* message */) |
| 72 |
62 // WebSocket messages that can be sent in either direction. | 73 // WebSocket messages that can be sent in either direction. |
63 | 74 |
64 IPC_ENUM_TRAITS(content::WebSocketMessageType) | 75 IPC_ENUM_TRAITS(content::WebSocketMessageType) |
65 | 76 |
66 // Send a non-control frame on |channel_id|. If the sender is the renderer, it | 77 // Send a non-control frame on |channel_id|. If the sender is the renderer, it |
67 // will be sent to the remote server. If the sender is the browser, it comes | 78 // will be sent to the remote server. If the sender is the browser, it comes |
68 // from the remote server. |fin| indicates that this frame is the last in the | 79 // from the remote server. |fin| indicates that this frame is the last in the |
69 // current message. |type| is the type of the message. On the first frame of a | 80 // current message. |type| is the type of the message. On the first frame of a |
70 // message, it must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or | 81 // message, it must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or |
71 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to | 82 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to |
(...skipping 21 matching lines...) Expand all Loading... |
93 // and the TCP/IP connection will be closed. | 104 // and the TCP/IP connection will be closed. |
94 // When sent by the browser, this indicates that a Close or DropChannel has been | 105 // When sent by the browser, this indicates that a Close or DropChannel has been |
95 // received, the connection was closed, or a network or protocol error | 106 // received, the connection was closed, or a network or protocol error |
96 // occurred. On receiving DropChannel, the renderer process may consider the | 107 // occurred. On receiving DropChannel, the renderer process may consider the |
97 // |channel_id| available for reuse by a new AddChannelRequest. | 108 // |channel_id| available for reuse by a new AddChannelRequest. |
98 // |code| is one of the reason codes specified in RFC6455 or | 109 // |code| is one of the reason codes specified in RFC6455 or |
99 // draft-ietf-hybi-websocket-multiplexing-09. |reason|, if non-empty, is a | 110 // draft-ietf-hybi-websocket-multiplexing-09. |reason|, if non-empty, is a |
100 // UTF-8 encoded string which may be useful for debugging but is not necessarily | 111 // UTF-8 encoded string which may be useful for debugging but is not necessarily |
101 // human-readable, as supplied by the server in the Close or DropChannel | 112 // human-readable, as supplied by the server in the Close or DropChannel |
102 // message. | 113 // message. |
103 IPC_MESSAGE_ROUTED2(WebSocketMsg_DropChannel, | 114 // If |was_clean| is false on a message from the browser, then the WebSocket |
| 115 // connection was not closed cleanly. If |was_clean| is false on a message from |
| 116 // the renderer, then the connection should be closed immediately without a |
| 117 // closing handshake and the renderer cannot accept any new messages about this |
| 118 // connection. |
| 119 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, |
| 120 bool /* was_clean */, |
104 unsigned short /* code */, | 121 unsigned short /* code */, |
105 std::string /* reason */) | 122 std::string /* reason */) |
OLD | NEW |