1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Multiply-included message file, hence no include guard. 6 #include <vector> 7 8 #include "content/common/content_export.h" 9 #include "ipc/ipc_message_macros.h" 10 #include "ipc/ipc_param_traits.h" 11 #include "url/gurl.h" 12 13 #undef IPC_MESSAGE_EXPORT 14 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 15 #define IPC_MESSAGE_START SocketStreamMsgStart 16 17 // Web Sockets messages sent from the renderer to the browser. 18 19 // Open new Socket Stream for the |socket_url| identified by |socket_id| 20 // in the renderer process. 21 // The browser starts connecting asynchronously. 22 // Once Socket Stream connection is established, the browser will send 23 // SocketStreamMsg_Connected back. 24 // |render_view_id| must be the routing id of RenderViewImpl to which the 25 // Socket Stream belongs. 26 IPC_MESSAGE_CONTROL3(SocketStreamHostMsg_Connect, 27 int /* render_view_id */, 28 GURL /* socket_url */, 29 int /* socket_id */) 30 31 // Request to send data on the Socket Stream. 32 // SocketStreamHandle can send data at most |max_pending_send_allowed| bytes, 33 // which is given by ViewMsg_SocketStream_Connected at any time. 34 // The number of pending bytes can be tracked by size of |data| sent 35 // and |amount_sent| parameter of ViewMsg_SocketStream_DataSent. 36 // That is, the following constraints is applied: 37 // (accumulated total of |data|) - (accumulated total of |amount_sent|) 38 // <= |max_pending_send_allowed| 39 // If the SocketStreamHandle ever tries to exceed the 40 // |max_pending_send_allowed|, the connection will be closed. 41 IPC_MESSAGE_CONTROL2(SocketStreamHostMsg_SendData, 42 int /* socket_id */, 43 std::vector<char> /* data */) 44 45 // Request to close the Socket Stream. 46 // The browser will send ViewMsg_SocketStream_Closed back when the Socket 47 // Stream is completely closed. 48 IPC_MESSAGE_CONTROL1(SocketStreamHostMsg_Close, 49 int /* socket_id */) 50 51 52 // Speech input messages sent from the browser to the renderer. 53 54 // A |socket_id| is assigned by SocketStreamHostMsg_Connect. 55 // The Socket Stream is connected. The SocketStreamHandle should keep track 56 // of how much it has pending (how much it has requested to be sent) and 57 // shouldn't go over |max_pending_send_allowed| bytes. 58 IPC_MESSAGE_CONTROL2(SocketStreamMsg_Connected, 59 int /* socket_id */, 60 int /* max_pending_send_allowed */) 61 62 // |data| is received on the Socket Stream. 63 IPC_MESSAGE_CONTROL2(SocketStreamMsg_ReceivedData, 64 int /* socket_id */, 65 std::vector<char> /* data */) 66 67 // |amount_sent| bytes of data requested by 68 // SocketStreamHostMsg_SendData has been sent on the Socket Stream. 69 IPC_MESSAGE_CONTROL2(SocketStreamMsg_SentData, 70 int /* socket_id */, 71 int /* amount_sent */) 72 73 // The Socket Stream is closed. 74 IPC_MESSAGE_CONTROL1(SocketStreamMsg_Closed, 75 int /* socket_id */) 76 77 // The Socket Stream is failed. 78 IPC_MESSAGE_CONTROL2(SocketStreamMsg_Failed, 79 int /* socket_id */, 80 int /* error_code */) 81