| 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 |
| 11 // removed. | 11 // removed. |
| 12 // | 12 // |
| 13 // This IPC interface is based on the WebSocket multiplexing draft spec, | 13 // This IPC interface is based on the WebSocket multiplexing draft spec, |
| 14 // http://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-09 | 14 // http://tools.ietf.org/html/draft-ietf-hybi-websocket-multiplexing-09 |
| 15 | 15 |
| 16 #include <string> | 16 #include <string> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "base/basictypes.h" | 19 #include "base/basictypes.h" |
| 20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
| 21 #include "content/common/websocket.h" | 21 #include "content/common/websocket.h" |
| 22 #include "ipc/ipc_message_macros.h" | 22 #include "ipc/ipc_message_macros.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 #include "url/origin.h" |
| 24 | 25 |
| 25 #undef IPC_MESSAGE_EXPORT | 26 #undef IPC_MESSAGE_EXPORT |
| 26 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 27 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 27 #define IPC_MESSAGE_START WebSocketMsgStart | 28 #define IPC_MESSAGE_START WebSocketMsgStart |
| 28 | 29 |
| 29 IPC_ENUM_TRAITS_MAX_VALUE(content::WebSocketMessageType, | 30 IPC_ENUM_TRAITS_MAX_VALUE(content::WebSocketMessageType, |
| 30 content::WEB_SOCKET_MESSAGE_TYPE_LAST) | 31 content::WEB_SOCKET_MESSAGE_TYPE_LAST) |
| 31 | 32 |
| 32 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeRequest) | 33 IPC_STRUCT_TRAITS_BEGIN(content::WebSocketHandshakeRequest) |
| 33 IPC_STRUCT_TRAITS_MEMBER(url) | 34 IPC_STRUCT_TRAITS_MEMBER(url) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 53 // 0x7FFFFFFF. |requested_protocols| is a list of tokens identifying | 54 // 0x7FFFFFFF. |requested_protocols| is a list of tokens identifying |
| 54 // sub-protocols the renderer would like to use, as described in RFC6455 | 55 // sub-protocols the renderer would like to use, as described in RFC6455 |
| 55 // "Subprotocols Using the WebSocket Protocol". | 56 // "Subprotocols Using the WebSocket Protocol". |
| 56 // | 57 // |
| 57 // The browser process will not send |channel_id| as-is to the remote server; it | 58 // The browser process will not send |channel_id| as-is to the remote server; it |
| 58 // will try to use a short id on the wire. This saves the renderer from | 59 // will try to use a short id on the wire. This saves the renderer from |
| 59 // having to try to choose the ids cleverly. | 60 // having to try to choose the ids cleverly. |
| 60 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest, | 61 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest, |
| 61 GURL /* socket_url */, | 62 GURL /* socket_url */, |
| 62 std::vector<std::string> /* requested_protocols */, | 63 std::vector<std::string> /* requested_protocols */, |
| 63 GURL /* origin */) | 64 url::Origin /* origin */) |
| 64 | 65 |
| 65 // WebSocket messages sent from the browser to the renderer. | 66 // WebSocket messages sent from the browser to the renderer. |
| 66 | 67 |
| 67 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is | 68 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is |
| 68 // scoped to the renderer process; while it is unique per-renderer, the browser | 69 // scoped to the renderer process; while it is unique per-renderer, the browser |
| 69 // may have multiple renderers using the same id. If |fail| is true, the channel | 70 // may have multiple renderers using the same id. If |fail| is true, the channel |
| 70 // could not be established (the cause of the failure is not provided to the | 71 // could not be established (the cause of the failure is not provided to the |
| 71 // renderer in order to limit its ability to abuse WebSockets to perform network | 72 // renderer in order to limit its ability to abuse WebSockets to perform network |
| 72 // probing, etc.). If |fail| is set then the |channel_id| is available for | 73 // probing, etc.). If |fail| is set then the |channel_id| is available for |
| 73 // re-use. |selected_protocol| is the sub-protocol the server selected, | 74 // re-use. |selected_protocol| is the sub-protocol the server selected, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // closing handshake and the renderer cannot accept any new messages on this | 150 // closing handshake and the renderer cannot accept any new messages on this |
| 150 // connection. | 151 // connection. |
| 151 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, | 152 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel, |
| 152 bool /* was_clean */, | 153 bool /* was_clean */, |
| 153 unsigned short /* code */, | 154 unsigned short /* code */, |
| 154 std::string /* reason */) | 155 std::string /* reason */) |
| 155 | 156 |
| 156 // Notify the renderer that a closing handshake has been initiated by the | 157 // Notify the renderer that a closing handshake has been initiated by the |
| 157 // server, so that it can set the Javascript readyState to CLOSING. | 158 // server, so that it can set the Javascript readyState to CLOSING. |
| 158 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) | 159 IPC_MESSAGE_ROUTED0(WebSocketMsg_NotifyClosing) |
| OLD | NEW |