| 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 28 matching lines...) Expand all Loading... |
| 39 #include "url/gurl.h" | 39 #include "url/gurl.h" |
| 40 #include "url/origin.h" | 40 #include "url/origin.h" |
| 41 | 41 |
| 42 #undef IPC_MESSAGE_EXPORT | 42 #undef IPC_MESSAGE_EXPORT |
| 43 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 43 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 44 #define IPC_MESSAGE_START WebSocketMsgStart | 44 #define IPC_MESSAGE_START WebSocketMsgStart |
| 45 | 45 |
| 46 IPC_ENUM_TRAITS_MAX_VALUE(content::WebSocketMessageType, | 46 IPC_ENUM_TRAITS_MAX_VALUE(content::WebSocketMessageType, |
| 47 content::WEB_SOCKET_MESSAGE_TYPE_LAST) | 47 content::WEB_SOCKET_MESSAGE_TYPE_LAST) |
| 48 | 48 |
| 49 IPC_ENUM_TRAITS_MAX_VALUE(content::WebSocketBinaryType, |
| 50 content::WebSocketBinaryType::LAST) |
| 51 |
| 49 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeRequest) | 52 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeRequest) |
| 50 IPC_STRUCT_TRAITS_MEMBER(url) | 53 IPC_STRUCT_TRAITS_MEMBER(url) |
| 51 IPC_STRUCT_TRAITS_MEMBER(headers) | 54 IPC_STRUCT_TRAITS_MEMBER(headers) |
| 52 IPC_STRUCT_TRAITS_MEMBER(headers_text) | 55 IPC_STRUCT_TRAITS_MEMBER(headers_text) |
| 53 IPC_STRUCT_TRAITS_MEMBER(request_time) | 56 IPC_STRUCT_TRAITS_MEMBER(request_time) |
| 54 IPC_STRUCT_TRAITS_END() | 57 IPC_STRUCT_TRAITS_END() |
| 55 | 58 |
| 56 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeResponse) | 59 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeResponse) |
| 57 IPC_STRUCT_TRAITS_MEMBER(url) | 60 IPC_STRUCT_TRAITS_MEMBER(url) |
| 58 IPC_STRUCT_TRAITS_MEMBER(status_code) | 61 IPC_STRUCT_TRAITS_MEMBER(status_code) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 // quota. See the design doc at | 86 // quota. See the design doc at |
| 84 // https://docs.google.com/document/d/1CDiXB9pBumhFVVfmIn1CRI6v6byxyqWu2urEE9xp7
14/edit | 87 // https://docs.google.com/document/d/1CDiXB9pBumhFVVfmIn1CRI6v6byxyqWu2urEE9xp7
14/edit |
| 85 // SendFrame or SendBlob IPCs must not be sent by the renderer until the | 88 // SendFrame or SendBlob IPCs must not be sent by the renderer until the |
| 86 // BlobSendComplete message has been received from the browser. The renderer | 89 // BlobSendComplete message has been received from the browser. The renderer |
| 87 // should retain a reference to the Blob until either a BlobSendComplete or | 90 // should retain a reference to the Blob until either a BlobSendComplete or |
| 88 // NotifyFailure IPC is received. | 91 // NotifyFailure IPC is received. |
| 89 IPC_MESSAGE_ROUTED2(WebSocketHostMsg_SendBlob, | 92 IPC_MESSAGE_ROUTED2(WebSocketHostMsg_SendBlob, |
| 90 std::string /* uuid */, | 93 std::string /* uuid */, |
| 91 uint64_t /* expected_size */) | 94 uint64_t /* expected_size */) |
| 92 | 95 |
| 96 // Indicate that the type for receiving Binary messages has changed. The |
| 97 // default type is WebSocketBinaryType::BLOB. In this mode the browser will |
| 98 // build Blobs from received messages and transmit them to the renderer with a |
| 99 // WebSocketMsg_BlobReceived IPC. The type can be changed to |
| 100 // WebSocketBinaryType::ARRAY_BUFFER, in which case Binary messages will be sent |
| 101 // to the renderer with WebSocketMsg_SendFrame IPCs in the same way as for Text |
| 102 // messages. Changes to the type only take effect at the start of the next |
| 103 // Binary message, so the render process has to be prepared to deal with a |
| 104 // message of the "wrong" type. |
| 105 IPC_MESSAGE_ROUTED1(WebSocketHostMsg_BinaryTypeChanged, |
| 106 content::WebSocketBinaryType /* new_type */); |
| 107 |
| 108 // After taking a reference to a Blob received via a WebSocketMsg_BlobReceived |
| 109 // IPC, the renderer should send this IPC to indicate that the browser no longer |
| 110 // needs to hold a reference to the Blob. There is no need to indicate which |
| 111 // Blob; they are confirmed in strict FIFO order. |
| 112 IPC_MESSAGE_ROUTED0(WebSocketHostMsg_BlobConfirmed); |
| 113 |
| 93 // WebSocket messages sent from the browser to the renderer. | 114 // WebSocket messages sent from the browser to the renderer. |
| 94 | 115 |
| 95 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the | 116 // Respond to an AddChannelRequest. |selected_protocol| is the sub-protocol the |
| 96 // server selected, or empty if no sub-protocol was selected. |extensions| is | 117 // server selected, or empty if no sub-protocol was selected. |extensions| is |
| 97 // the list of extensions negotiated for the connection. | 118 // the list of extensions negotiated for the connection. |
| 98 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse, | 119 IPC_MESSAGE_ROUTED2(WebSocketMsg_AddChannelResponse, |
| 99 std::string /* selected_protocol */, | 120 std::string /* selected_protocol */, |
| 100 std::string /* extensions */) | 121 std::string /* extensions */) |
| 101 | 122 |
| 102 // Notify the renderer that the browser has started an opening handshake. | 123 // Notify the renderer that the browser has started an opening handshake. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 126 // TODO(yhirano): Find the way to pass |message| directly to the inspector | 147 // TODO(yhirano): Find the way to pass |message| directly to the inspector |
| 127 // process. | 148 // process. |
| 128 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, | 149 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure, |
| 129 std::string /* message */) | 150 std::string /* message */) |
| 130 | 151 |
| 131 // Indicates tbat the current Blob has finished sending. The renderer can | 152 // 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 | 153 // release its reference on the Blob, and may now use SendFrame or SendBlob to |
| 133 // send more messages. | 154 // send more messages. |
| 134 IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete); | 155 IPC_MESSAGE_ROUTED0(WebSocketMsg_BlobSendComplete); |
| 135 | 156 |
| 157 // Indicates that a complete binary message has been received and stored in a |
| 158 // Blob. The Blob does not count against the flow control quota supplied by the |
| 159 // render process. |
| 160 IPC_MESSAGE_ROUTED2(WebSocketMsg_BlobReceived, |
| 161 std::string /* uuid */, |
| 162 uint64_t /* size */); |
| 163 |
| 136 // WebSocket messages that can be sent in either direction. | 164 // WebSocket messages that can be sent in either direction. |
| 137 | 165 |
| 138 // Send a non-control frame to the channel. | 166 // Send a non-control frame to the channel. |
| 139 // - If the sender is the renderer, it will be sent to the remote server. | 167 // - If the sender is the renderer, it will be sent to the remote server. |
| 140 // - If the sender is the browser, it comes from the remote server. | 168 // - If the sender is the browser, it comes from the remote server. |
| 141 // | 169 // |
| 142 // - |fin| indicates that this frame is the last in the current message. | 170 // - |fin| indicates that this frame is the last in the current message. |
| 143 // - |type| is the type of the message. On the first frame of a message, it | 171 // - |type| is the type of the message. On the first frame of a message, it |
| 144 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or | 172 // must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or |
| 145 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to | 173 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // a closing handshake and the renderer cannot accept any new messages on this | 214 // a closing handshake and the renderer cannot accept any new messages on this |
| 187 // connection. | 215 // connection. |
| 188 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, | 216 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, |
| 189 bool /* was_clean */, | 217 bool /* was_clean */, |
| 190 unsigned short /* code */, | 218 unsigned short /* code */, |
| 191 std::string /* reason */) | 219 std::string /* reason */) |
| 192 | 220 |
| 193 // Notify the renderer that a closing handshake has been initiated by the | 221 // Notify the renderer that a closing handshake has been initiated by the |
| 194 // server, so that it can set the Javascript readyState to CLOSING. | 222 // server, so that it can set the Javascript readyState to CLOSING. |
| 195 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) | 223 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) |
| OLD | NEW |