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. | 8 // WebSockets. |
9 // | 9 // |
10 // This IPC interface was originally desined based on the WebSocket | 10 // This IPC interface was originally desined based on the WebSocket |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 // Open new WebSocket connection to |socket_url|. |requested_protocols| is a | 67 // Open new WebSocket connection to |socket_url|. |requested_protocols| is a |
68 // list of tokens identifying sub-protocols the renderer would like to use, as | 68 // list of tokens identifying sub-protocols the renderer would like to use, as |
69 // described in RFC6455 "Subprotocols Using the WebSocket Protocol". | 69 // described in RFC6455 "Subprotocols Using the WebSocket Protocol". |
70 IPC_MESSAGE_ROUTED4(WebSocketHostMsg_AddChannelRequest, | 70 IPC_MESSAGE_ROUTED4(WebSocketHostMsg_AddChannelRequest, |
71 GURL /* socket_url */, | 71 GURL /* socket_url */, |
72 std::vector<std::string> /* requested_protocols */, | 72 std::vector<std::string> /* requested_protocols */, |
73 url::Origin /* origin */, | 73 url::Origin /* origin */, |
74 int /* render_frame_id */) | 74 int /* render_frame_id */) |
75 | 75 |
| 76 // Send a complete binary WebSocket message consisting of the Blob identified by |
| 77 // |uuid|. The message will be split into frames as necessary. |expected_size| |
| 78 // must match the browser's idea of the size of the Blob to prevent flow control |
| 79 // from becoming desynchronised. If it does not match the connection will be |
| 80 // terminated with a WebSocketMsg_NotifyFailure message. On success, the browser |
| 81 // will have consumed |expected_size| bytes of flow control send quota and the |
| 82 // renderer needs to subtract that from its running total of flow control send |
| 83 // quota. See the design doc at |
| 84 // https://docs.google.com/document/d/1CDiXB9pBumhFVVfmIn1CRI6v6byxyqWu2urEE9xp7
14/edit |
| 85 // SendFrame or SendBlob IPCs must not be sent by the renderer until the |
| 86 // BlobSendComplete message has been received from the browser. The renderer |
| 87 // should retain a reference to the Blob until either a BlobSendComplete or |
| 88 // NotifyFailure IPC is received. |
| 89 IPC_MESSAGE_ROUTED2(WebSocketHostMsg_SendBlob, |
| 90 std::string /* uuid */, |
| 91 uint64_t /* expected_size */) |
| 92 |
76 // WebSocket messages sent from the browser to the renderer. | 93 // WebSocket messages sent from the browser to the renderer. |
77 | 94 |
78 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the | 95 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the |
79 // server selected, or empty if no sub-protocol was selected. |extensions| is | 96 // server selected, or empty if no sub-protocol was selected. |extensions| is |
80 // the list of extensions negotiated for the connection. | 97 // the list of extensions negotiated for the connection. |
81 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse, | 98 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse, |
82 std::string /* selected_protocol */, | 99 std::string /* selected_protocol */, |
83 std::string /* extensions */) | 100 std::string /* extensions */) |
84 | 101 |
85 // Notify the renderer that the browser has started an opening handshake. | 102 // Notify the renderer that the browser has started an opening handshake. |
(...skipping 18 matching lines...) Expand all Loading... |
104 // 1. Fire an error event. | 121 // 1. Fire an error event. |
105 // 2. Show |message| to the inspector. | 122 // 2. Show |message| to the inspector. |
106 // 3. Close the channel immediately uncleanly, as if it received | 123 // 3. Close the channel immediately uncleanly, as if it received |
107 // DropChannel(was_clean = false, code = 1006, reason = ""). | 124 // DropChannel(was_clean = false, code = 1006, reason = ""). |
108 // |message| will be shown in the inspector and won't be passed to the script. | 125 // |message| will be shown in the inspector and won't be passed to the script. |
109 // TODO(yhirano): Find the way to pass |message| directly to the inspector | 126 // TODO(yhirano): Find the way to pass |message| directly to the inspector |
110 // process. | 127 // process. |
111 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, | 128 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, |
112 std::string /* message */) | 129 std::string /* message */) |
113 | 130 |
| 131 // Indicates tbat the current Blob has finished sending. The renderer can |
| 132 // release its reference on the Blob, and may now use SendFrame or SendBlob to |
| 133 // send more messages. |
| 134 IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete); |
| 135 |
114 // WebSocket messages that can be sent in either direction. | 136 // WebSocket messages that can be sent in either direction. |
115 | 137 |
116 // Send a non-control frame to the channel. | 138 // Send a non-control frame to the channel. |
117 // - If the sender is the renderer, it will be sent to the remote server. | 139 // - If the sender is the renderer, it will be sent to the remote server. |
118 // - If the sender is the browser, it comes from the remote server. | 140 // - If the sender is the browser, it comes from the remote server. |
119 // | 141 // |
120 // - |fin| indicates that this frame is the last in the current message. | 142 // - |fin| indicates that this frame is the last in the current message. |
121 // - |type| is the type of the message. On the first frame of a message, it | 143 // - |type| is the type of the message. On the first frame of a message, it |
122 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or | 144 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or |
123 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to | 145 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // a closing handshake and the renderer cannot accept any new messages on this | 178 // a closing handshake and the renderer cannot accept any new messages on this |
157 // connection. | 179 // connection. |
158 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, | 180 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, |
159 bool /* was_clean */, | 181 bool /* was_clean */, |
160 unsigned short /* code */, | 182 unsigned short /* code */, |
161 std::string /* reason */) | 183 std::string /* reason */) |
162 | 184 |
163 // Notify the renderer that a closing handshake has been initiated by the | 185 // Notify the renderer that a closing handshake has been initiated by the |
164 // server, so that it can set the Javascript readyState to CLOSING. | 186 // server, so that it can set the Javascript readyState to CLOSING. |
165 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) | 187 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) |
OLD | NEW |