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 "type": "object", 103 "isInstanceOf": "global", 104 "additionalProperties": { "type": "any" }, 105 "description": "The JavaScript <code>window</code> object of panel's page." 106 } 107 ] 108 }, 109 { 110 "name": "onHidden", 111 "type": "function", 112 "description": "Fired when the user switches away from the panel." 113 } 114 ] 115 }, 116 { 117 "id": "ExtensionSidebarPane", 118 "type": "object", 119 "description": "A sidebar created by the extension.", 120 "functions": [ 121 { 122 "name": "setHeight", 123 "type": "function", 124 "description": "Sets the height of the sidebar.", 125 "parameters": [ 126 { 127 "name": "height", 128 "type": "string", 129 "description": "A CSS-like size specification, such as <code>'100px'</code> or <code>'12ex'</code>." 130 } 131 ] 132 }, 133 { 134 "name": "setExpression", 135 "type": "function", 136 "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.", 137 "parameters": [ 138 { 139 "name": "expression", 140 "type": "string", 141 "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." 142 }, 143 { 144 "name": "rootTitle", 145 "type": "string", 146 "optional": true, 147 "description": "An optional title for the root of the expression tree." 148 }, 149 { 150 "name": "callback", 151 "type": "function", 152 "optional": true, 153 "description": "A callback invoked after the sidebar pane is updated with the expression evaluation results." 154 } 155 ] 156 }, 157 { 158 "name": "setObject", 159 "type": "function", 160 "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.", 161 "parameters": [ 162 { 163 "name": "jsonObject", 164 "type": "string", 165 "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)." 166 }, 167 { 168 "name": "rootTitle", 169 "type": "string", 170 "optional": true, 171 "description": "An optional title for the root of the expression tree." 172 }, 173 { 174 "name": "callback", 175 "type": "function", 176 "optional": true, 177 "description": "A callback invoked after the sidebar is updated with the object." 178 } 179 ] 180 }, 181 { 182 "name": "setPage", 183 "type": "function", 184 "description": "Sets an HTML page to be displayed in the sidebar pane.", 185 "parameters": [ 186 { 187 "name": "path", 188 "type": "string", 189 "description": "Relative path of an extension page to display within the sidebar." 190 } 191 ] 192 } 193 ], 194 "events": [ 195 { 196 "name": "onShown", 197 "type": "function", 198 "description": "Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it.", 199 "parameters": [ 200 { 201 "name": "window", 202 "type": "object", 203 "isInstanceOf": "global", 204 "additionalProperties": { "type": "any" }, 205 "description": "The JavaScript <code>window</code> object of the sidebar page, if one was set with the <code>setPage()</code> method." 206 } 207 ] 208 }, 209 { 210 "name": "onHidden", 211 "type": "function", 212 "description": "Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane." 213 } 214 ] 215 }, 216 { 217 "id": "Button", 218 "type": "object", 219 "description": "A button created by the extension.", 220 "functions": [ 221 { 222 "name": "update", 223 "description": "Updates the attributes of the button. If some of the arguments are omitted or <code>null</code>, the corresponding attributes are not updated.", 224 "parameters": [ 225 { 226 "name": "iconPath", 227 "type": "string", 228 "optional": true, 229 "description": "Path to the new icon of the button." 230 }, 231 { 232 "name": "tooltipText", 233 "type": "string", 234 "optional": true, 235 "description": "Text shown as a tooltip when user hovers the mouse over the button." 236 }, 237 { 238 "name": "disabled", 239 "type": "boolean", 240 "optional": true, 241 "description": "Whether the button is disabled." 242 } 243 ] 244 } 245 ], 246 "events": [ 247 { 248 "name": "onClicked", 249 "type": "function", 250 "description": "Fired when the button is clicked." 251 } 252 ] 253 } 254 ], 255 "properties": { 256 "elements": { 257 "$ref": "ElementsPanel", 258 "description": "Elements panel." 259 } 260 }, 261 "functions": [ 262 { 263 "name": "create", 264 "type": "function", 265 "description": "Creates an extension panel.", 266 "parameters": [ 267 { 268 "name": "title", 269 "type": "string", 270 "description": "Title that is displayed next to the extension icon in the Developer Tools toolbar." 271 }, 272 { 273 "name": "iconPath", 274 "type": "string", 275 "description": "Path of the panel's icon relative to the extension directory." 276 }, 277 { 278 "name": "pagePath", 279 "type": "string", 280 "description": "Path of the panel's HTML page relative to the extension directory." 281 }, 282 { 283 "name": "callback", 284 "type": "function", 285 "optional": true, 286 "description": "A function that is called when the panel is created.", 287 "parameters": [ 288 { 289 "name": "panel", 290 "description": "An ExtensionPanel object representing the created panel.", 291 "$ref": "ExtensionPanel" 292 } 293 ] 294 } 295 ] 296 }, 297 { 298 "name": "setOpenResourceHandler", 299 "type": "function", 300 "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.", 301 "parameters": [ 302 { 303 "name": "callback", 304 "type": "function", 305 "optional": true, 306 "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.", 307 "parameters": [ 308 { 309 "name": "resource", 310 "$ref": "devtools.inspectedWindow.Resource", 311 "description": "A $(ref:devtools.inspectedWindow.Resource) object for the resource that was clicked." 312 } 313 ] 314 } 315 ] 316 } 317 ] 318 } 319 ] 320