• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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[
6  {
7    "namespace": "devtools.panels",
8    "description": "Use the <code>chrome.devtools.panels</code> API to integrate your extension into Developer Tools window UI: create your own panels, access existing panels, and add sidebars.",
9    "nocompile": true,
10    "types": [
11      {
12        "id": "ElementsPanel",
13        "type": "object",
14        "description": "Represents the Elements panel.",
15        "events": [
16          {
17            "name": "onSelectionChanged",
18            "description": "Fired when an object is selected in the panel."
19          }
20        ],
21        "functions": [
22          {
23            "name": "createSidebarPane",
24            "type": "function",
25            "description": "Creates a pane within panel's sidebar.",
26            "parameters": [
27              {
28                "name": "title",
29                "type": "string",
30                "description": "Text that is displayed in sidebar caption."
31              },
32              {
33                "name": "callback",
34                "type": "function",
35                "description": "A callback invoked when the sidebar is created.",
36                "optional": true,
37                "parameters": [
38                  {
39                    "name": "result",
40                    "description": "An ExtensionSidebarPane object for created sidebar pane.",
41                    "$ref": "ExtensionSidebarPane"
42                  }
43                ]
44              }
45            ]
46          }
47        ]
48      },
49      {
50        "id": "ExtensionPanel",
51        "type": "object",
52        "description": "Represents a panel created by extension.",
53        "functions": [
54          {
55            "name": "createStatusBarButton",
56            "description": "Appends a button to the status bar of the panel.",
57            "parameters": [
58              {
59                "name": "iconPath",
60                "type": "string",
61                "description": "Path to the icon of the button. The file should contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used when the button is inactive; the right icon is displayed when the button is pressed."
62              },
63              {
64                "name": "tooltipText",
65                "type": "string",
66                "description": "Text shown as a tooltip when user hovers the mouse over the button."
67              },
68              {
69                "name": "disabled",
70                "type": "boolean",
71                "description": "Whether the button is disabled."
72              }
73            ],
74            "returns": { "$ref": "Button" }
75          }
76        ],
77        "events": [
78          {
79            "name": "onSearch",
80            "description": "Fired upon a search action (start of a new search, search result navigation, or search being canceled).",
81            "parameters": [
82              {
83                "name": "action",
84                "type": "string",
85                "description": "Type of search action being performed."
86              },
87              {
88                "name": "queryString",
89                "type": "string",
90                "optional": true,
91                "description": "Query string (only for 'performSearch')."
92              }
93            ]
94          },
95          {
96            "name": "onShown",
97            "type": "function",
98            "description": "Fired when the user switches to the panel.",
99            "parameters": [
100              {
101                "name": "window",
102                "$ref": "windows.Window",
103                "description": "The <code>window</code> object of panel's page."
104              }
105            ]
106          },
107          {
108            "name": "onHidden",
109            "type": "function",
110            "description": "Fired when the user switches away from the panel."
111          }
112        ]
113      },
114      {
115        "id": "ExtensionSidebarPane",
116        "type": "object",
117        "description": "A sidebar created by the extension.",
118        "functions": [
119          {
120            "name": "setHeight",
121            "type": "function",
122            "description": "Sets the height of the sidebar.",
123            "parameters": [
124              {
125                "name": "height",
126                "type": "string",
127                "description": "A CSS-like size specification, such as <code>'100px'</code> or <code>'12ex'</code>."
128              }
129            ]
130          },
131          {
132            "name": "setExpression",
133            "type": "function",
134            "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.",
135            "parameters": [
136              {
137                "name": "expression",
138                "type": "string",
139                "description": "An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch."
140              },
141              {
142                "name": "rootTitle",
143                "type": "string",
144                "optional": true,
145                "description": "An optional title for the root of the expression tree."
146              },
147              {
148                "name": "callback",
149                "type": "function",
150                "optional": true,
151                "description": "A callback invoked after the sidebar pane is updated with the expression evaluation results."
152              }
153            ]
154          },
155          {
156            "name": "setObject",
157            "type": "function",
158            "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.",
159            "parameters": [
160              {
161                "name": "jsonObject",
162                "type": "string",
163                "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)."
164              },
165              {
166                "name": "rootTitle",
167                "type": "string",
168                "optional": true,
169                "description": "An optional title for the root of the expression tree."
170              },
171              {
172                "name": "callback",
173                "type": "function",
174                "optional": true,
175                "description": "A callback invoked after the sidebar is updated with the object."
176              }
177            ]
178          },
179          {
180            "name": "setPage",
181            "type": "function",
182            "description": "Sets an HTML page to be displayed in the sidebar pane.",
183            "parameters": [
184              {
185                "name": "path",
186                "type": "string",
187                "description": "Relative path of an extension page to display within the sidebar."
188              }
189            ]
190          }
191        ],
192        "events": [
193          {
194            "name": "onShown",
195            "type": "function",
196            "description": "Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it.",
197            "parameters": [
198              {
199                "name": "window",
200                "$ref": "windows.Window",
201                "optional": true,
202                "description": "The <code>window</code> object of the sidebar page, if one was set with the <code>setPage()</code> method."
203              }
204            ]
205          },
206          {
207            "name": "onHidden",
208            "type": "function",
209            "description": "Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane."
210          }
211        ]
212      },
213      {
214        "id": "Button",
215        "type": "object",
216        "description": "A button created by the extension.",
217        "functions": [
218          {
219            "name": "update",
220            "description": "Updates the attributes of the button. If some of the arguments are omitted or <code>null</code>, the corresponding attributes are not updated.",
221            "parameters": [
222              {
223                "name": "iconPath",
224                "type": "string",
225                "optional": true,
226                "description": "Path to the new icon of the button."
227              },
228              {
229                "name": "tooltipText",
230                "type": "string",
231                "optional": true,
232                "description": "Text shown as a tooltip when user hovers the mouse over the button."
233              },
234              {
235                "name": "disabled",
236                "type": "boolean",
237                "optional": true,
238                "description": "Whether the button is disabled."
239              }
240            ]
241          }
242        ],
243        "events": [
244          {
245            "name": "onClicked",
246            "type": "function",
247            "description": "Fired when the button is clicked."
248          }
249        ]
250      }
251    ],
252    "properties": {
253      "elements": {
254        "$ref": "ElementsPanel",
255        "description": "Elements panel."
256      }
257    },
258    "functions": [
259      {
260        "name": "create",
261        "type": "function",
262        "description": "Creates an extension panel.",
263        "parameters": [
264          {
265            "name": "title",
266            "type": "string",
267            "description": "Title that is displayed next to the extension icon in the Developer Tools toolbar."
268          },
269          {
270            "name": "iconPath",
271            "type": "string",
272            "description": "Path of the panel's icon relative to the extension directory."
273          },
274          {
275            "name": "pagePath",
276            "type": "string",
277            "description": "Path of the panel's HTML page relative to the extension directory."
278          },
279          {
280            "name": "callback",
281            "type": "function",
282            "optional": true,
283            "description": "A function that is called when the panel is created.",
284            "parameters": [
285              {
286                "name": "panel",
287                "description": "An ExtensionPanel object representing the created panel.",
288                "$ref": "ExtensionPanel"
289              }
290            ]
291          }
292        ]
293      },
294      {
295        "name": "setOpenResourceHandler",
296        "type": "function",
297        "description": "Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter.",
298        "parameters": [
299          {
300            "name": "callback",
301            "type": "function",
302            "optional": true,
303            "description": "A function that is called when the user clicks on a valid resource link in Developer Tools window. Note that if the user clicks an invalid URL or an XHR, this function is not called.",
304            "parameters": [
305              {
306                "name": "resource",
307                "$ref": "devtools.inspectedWindow.Resource",
308                "description": "A $ref:devtools.inspectedWindow.Resource object for the resource that was clicked."
309              }
310            ]
311          }
312        ]
313      }
314    ]
315  }
316]
317