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:
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.
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
21 // ----------------------------
22 // | (tools frontend |
23 // | renderer process) |
24 // | | --------------------
25 // |tools <--> DevToolsClient+<-- IPC -->+ (browser process) |
27 // ---------------------------- ---------+----------
33 // --------------------------+--------
34 // | inspected page <--> DevToolsAgent |
36 // | (inspected page renderer process) |
37 // -----------------------------------
39 // This file describes developer tools message types.
41 // Multiply-included message file, no standard include guard.
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
57 // WebKit-level transport.
58 IPC_MESSAGE_ROUTED1(DevToolsClientMsg_DispatchOnInspectorFrontend
,
59 std::string
/* message */)
61 //-----------------------------------------------------------------------------
62 // These are messages sent from DevToolsClient to DevToolsAgent through the
64 // Tells agent that there is a client host connected to it.
65 IPC_MESSAGE_ROUTED0(DevToolsAgentMsg_Attach
)
67 // Tells agent that a client host was disconnected from another agent and
68 // connected to this one.
69 IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_Reattach
,
70 std::string
/* agent_state */)
72 // Tells agent that there is no longer a client host connected to it.
73 IPC_MESSAGE_ROUTED0(DevToolsAgentMsg_Detach
)
75 // WebKit-level transport.
76 IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_DispatchOnInspectorBackend
,
77 std::string
/* message */)
79 // Inspect element with the given coordinates.
80 IPC_MESSAGE_ROUTED2(DevToolsAgentMsg_InspectElement
,
84 // Add message to the devtools console.
85 IPC_MESSAGE_ROUTED2(DevToolsAgentMsg_AddMessageToConsole
,
86 content::ConsoleMessageLevel
/* level */,
87 std::string
/* message */)
89 // Notifies worker devtools agent that it should pause worker context
90 // when it starts and wait until either DevTools client is attached or
91 // explicit resume notification is received.
92 IPC_MESSAGE_ROUTED0(DevToolsAgentMsg_PauseWorkerContextOnStart
)
94 // Worker DevTools agent should resume worker execution.
95 IPC_MESSAGE_ROUTED0(DevToolsAgentMsg_ResumeWorkerContext
)
97 //-----------------------------------------------------------------------------
98 // These are messages sent from the browser to the renderer.
100 // RenderViewHostDelegate::RenderViewCreated method sends this message to a
101 // new renderer to notify it that it will host developer tools UI and should
102 // set up all neccessary bindings and create DevToolsClient instance that
103 // will handle communication with inspected page DevToolsAgent.
104 IPC_MESSAGE_ROUTED0(DevToolsMsg_SetupDevToolsClient
)
107 //-----------------------------------------------------------------------------
108 // These are messages sent from the renderer to the browser.
110 // Activates (brings to the front) corresponding dev tools window.
111 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_ActivateWindow
)
113 // Sets the height of corresponding dev tools window.
114 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_ChangeAttachedWindowHeight
,
115 unsigned /* height */)
117 // Closes dev tools window that is inspecting current render_view_host.
118 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_CloseWindow
)
120 // Moves the corresponding dev tools window by the specified offset.
121 IPC_MESSAGE_ROUTED2(DevToolsHostMsg_MoveWindow
,
125 // Specifies side for devtools to dock to.
126 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_RequestSetDockSide
,
127 std::string
/* side */)
129 // Opens given URL in the new tab.
130 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_OpenInNewTab
,
131 std::string
/* url */)
133 // Shows Save As dialog for content.
134 IPC_MESSAGE_ROUTED3(DevToolsHostMsg_Save
,
135 std::string
/* url */,
136 std::string
/* content */,
139 // Appends given |content| to the file that has been associated with the
140 // given |url| by Save message handler.
141 IPC_MESSAGE_ROUTED2(DevToolsHostMsg_Append
,
142 std::string
/* url */,
143 std::string
/* content */)
145 // Requests the list of filesystems previously added for devtools.
146 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_RequestFileSystems
)
148 // Shows a dialog to select a folder to which an isolated filesystem is added.
149 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_AddFileSystem
)
151 // Removes a previously added devtools filesystem given by |file_system_path|.
152 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_RemoveFileSystem
,
153 std::string
/* file_system_path */)
155 // Performs file system indexing for given |file_system_path| and sends progress
157 IPC_MESSAGE_ROUTED2(DevToolsHostMsg_IndexPath
,
158 int /* request_id */,
159 std::string
/* file_system_path */)
161 // Stops file system indexing.
162 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_StopIndexing
, int /* request_id */)
164 // Performs trigram search for given |query| in |file_system_path|.
165 IPC_MESSAGE_ROUTED3(DevToolsHostMsg_SearchInPath
,
166 int /* request_id */,
167 std::string
/* file_system_path */,
168 std::string
/* query */)
170 // Updates agent runtime state stored in devtools manager in order to support
171 // cross-navigation instrumentation.
172 IPC_MESSAGE_ROUTED1(DevToolsHostMsg_SaveAgentRuntimeState
,
173 std::string
/* state */)
175 // Clears browser cache.
176 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_ClearBrowserCache
)
178 // Clears browser cookies.
179 IPC_MESSAGE_ROUTED0(DevToolsHostMsg_ClearBrowserCookies
)
182 //-----------------------------------------------------------------------------
183 // These are messages sent from the inspected page renderer to the worker