Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / common / devtools_messages.h
bloba6e17ecdb585b038968ff0dfb6e50866d76401c7
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.
5 // Developer tools consist of the following parts:
6 //
7 // DevToolsAgent lives in the renderer of an inspected page and provides access
8 // to the pages resources, DOM, v8 etc. by means of IPC messages.
9 //
10 // DevToolsClient is a thin delegate that lives in the tools front-end
11 // renderer and converts IPC messages to frontend method calls and allows the
12 // frontend to send messages to the DevToolsAgent.
14 // All the messages are routed through browser process. There is a
15 // DevToolsManager living in the browser process that is responsible for
16 // routing logistics. It is also capable of sending direct messages to the
17 // agent rather than forwarding messages between agents and clients only.
19 // Chain of communication between the components may be described by the
20 // following diagram:
21 // ----------------------------
22 // | (tools frontend |
23 // | renderer process) |
24 // | | --------------------
25 // |tools <--> DevToolsClient+<-- IPC -->+ (browser process) |
26 // |frontend | | |
27 // ---------------------------- ---------+----------
28 // ^
29 // |
30 // IPC
31 // |
32 // v
33 // --------------------------+--------
34 // | inspected page <--> DevToolsAgent |
35 // | |
36 // | (inspected page renderer process) |
37 // -----------------------------------
39 // This file describes developer tools message types.
41 // Multiply-included message file, no standard include guard.
42 #include <map>
43 #include <string>
45 #include "content/common/content_export.h"
46 #include "content/public/common/common_param_traits.h"
47 #include "content/public/common/console_message_level.h"
48 #include "ipc/ipc_message_macros.h"
50 #undef IPC_MESSAGE_EXPORT
51 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
53 #define IPC_MESSAGE_START DevToolsMsgStart
55 // These are messages sent from DevToolsAgent to DevToolsClient through the
56 // browser.
58 // Agent -> Client message chunk.
59 // |is_first| marks the first chunk, comes with the |message_size| for
60 // total message size.
61 // |is_last| marks the last chunk. |call_id| and |post_state| are optional
62 // parameters passed with the last chunk of the protocol response.
63 IPC_STRUCT_BEGIN(DevToolsMessageChunk)
64 IPC_STRUCT_MEMBER(bool, is_first)
65 IPC_STRUCT_MEMBER(bool, is_last)
66 IPC_STRUCT_MEMBER(int, message_size)
67 IPC_STRUCT_MEMBER(int, call_id)
68 IPC_STRUCT_MEMBER(std::string, data)
69 IPC_STRUCT_MEMBER(std::string, post_state)
70 IPC_STRUCT_END()
72 // Sends response from the agent to the client. Supports chunked encoding.
73 IPC_MESSAGE_ROUTED1(DevToolsClientMsg_DispatchOnInspectorFrontend,
74 DevToolsMessageChunk /* message */)
76 //-----------------------------------------------------------------------------
77 // These are messages sent from DevToolsClient to DevToolsAgent through the
78 // browser.
79 // Tells agent that there is a client host connected to it.
80 IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_Attach,
81 std::string /* host_id */)
83 // Tells agent that a client host was disconnected from another agent and
84 // connected to this one.
85 IPC_MESSAGE_ROUTED2(DevToolsAgentMsg_Reattach,
86 std::string /* host_id */,
87 std::string /* agent_state */)
89 // Tells agent that there is no longer a client host connected to it.
90 IPC_MESSAGE_ROUTED0(DevToolsAgentMsg_Detach)
92 // WebKit-level transport.
93 IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_DispatchOnInspectorBackend,
94 std::string /* message */)
96 // Inspect element with the given coordinates.
97 IPC_MESSAGE_ROUTED3(DevToolsAgentMsg_InspectElement,
98 std::string /* host_id */,
99 int /* x */,
100 int /* y */)
102 //-----------------------------------------------------------------------------
103 // These are messages sent from the browser to the renderer.
105 // RenderViewHostDelegate::RenderViewCreated method sends this message to a
106 // new renderer to notify it that it will host developer tools UI and should
107 // set up all neccessary bindings and create DevToolsClient instance that
108 // will handle communication with inspected page DevToolsAgent.
109 IPC_MESSAGE_ROUTED1(DevToolsMsg_SetupDevToolsClient,
110 std::string /* compatibility script */)
113 //-----------------------------------------------------------------------------
114 // These are messages sent from the renderer to the browser.
116 // Transport from Inspector frontend to frontend host.
117 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_DispatchOnEmbedder,
118 std::string /* message */)