Chromium Code Reviews| 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 | |
|
Adam Rice
2013/10/23 07:15:30
If we had a way to pass the message directly to th
yhirano
2013/10/23 08:10:42
Done.
| |
| 67 // script. | |
| 68 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, | |
| 69 std::string /* message */) | |
| 70 | |
| 62 // WebSocket messages that can be sent in either direction. | 71 // WebSocket messages that can be sent in either direction. |
| 63 | 72 |
| 64 IPC_ENUM_TRAITS(content::WebSocketMessageType) | 73 IPC_ENUM_TRAITS(content::WebSocketMessageType) |
| 65 | 74 |
| 66 // Send a non-control frame on |channel_id|. If the sender is the renderer, it | 75 // 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 | 76 // 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 | 77 // 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 | 78 // 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 | 79 // 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 | 80 // 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. | 102 // and the TCP/IP connection will be closed. |
| 94 // When sent by the browser, this indicates that a Close or DropChannel has been | 103 // 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 | 104 // received, the connection was closed, or a network or protocol error |
| 96 // occurred. On receiving DropChannel, the renderer process may consider the | 105 // occurred. On receiving DropChannel, the renderer process may consider the |
| 97 // |channel_id| available for reuse by a new AddChannelRequest. | 106 // |channel_id| available for reuse by a new AddChannelRequest. |
| 98 // |code| is one of the reason codes specified in RFC6455 or | 107 // |code| is one of the reason codes specified in RFC6455 or |
| 99 // draft-ietf-hybi-websocket-multiplexing-09. |reason|, if non-empty, is a | 108 // 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 | 109 // 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 | 110 // human-readable, as supplied by the server in the Close or DropChannel |
| 102 // message. | 111 // message. |
| 103 IPC_MESSAGE_ROUTED2(WebSocketMsg_DropChannel, | 112 // If |was_clean| is false on a message from the browser, then the WebSocket |
| 113 // connection was not closed cleanly. If |was_clean| is false on a message from | |
| 114 // the renderer, then the connection should be closed immediately without a | |
| 115 // closing handshake and the renderer cannot accept any new messages about this | |
| 116 // connection. | |
| 117 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, | |
| 118 bool /* was_clean */, | |
| 104 unsigned short /* code */, | 119 unsigned short /* code */, |
| 105 std::string /* reason */) | 120 std::string /* reason */) |
| OLD | NEW |