// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. [ { "namespace": "devtools.panels", "allowedContexts": ["devtools", "devtools_only"], "defaultContexts": ["devtools", "devtools_only"], "description": "Use the chrome.devtools.panels API to integrate your extension into Developer Tools window UI: create your own panels, access existing panels, and add sidebars.", "nocompile": true, "types": [ { "id": "ElementsPanel", "type": "object", "description": "Represents the Elements panel.", "events": [ { "name": "onSelectionChanged", "type": "function", "description": "Fired when an object is selected in the panel." } ], "functions": [ { "name": "createSidebarPane", "async": "callback", "type": "function", "description": "Creates a pane within panel's sidebar.", "parameters": [ { "name": "title", "type": "string", "description": "Text that is displayed in sidebar caption." }, { "name": "callback", "type": "function", "description": "A callback invoked when the sidebar is created.", "optional": true, "parameters": [ { "name": "result", "description": "An ExtensionSidebarPane object for created sidebar pane.", "$ref": "ExtensionSidebarPane" } ] } ] } ] }, { "id": "SourcesPanel", "type": "object", "description": "Represents the Sources panel.", "events": [ { "name": "onSelectionChanged", "unsupported": true, "description": "Fired when an object is selected in the panel." } ], "functions": [ { "name": "createSidebarPane", "unsupported": true, "type": "function", "description": "Creates a pane within panel's sidebar.", "parameters": [ { "name": "title", "type": "string", "description": "Text that is displayed in sidebar caption." }, { "name": "callback", "type": "function", "description": "A callback invoked when the sidebar is created.", "optional": true, "parameters": [ { "name": "result", "description": "An ExtensionSidebarPane object for created sidebar pane.", "$ref": "ExtensionSidebarPane" } ] } ] } ] }, { "id": "ExtensionPanel", "type": "object", "description": "Represents a panel created by extension.", "functions": [ { "name": "createStatusBarButton", "unsupported": true, "description": "Appends a button to the status bar of the panel.", "type": "function", "parameters": [ { "name": "iconPath", "type": "string", "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." }, { "name": "tooltipText", "type": "string", "description": "Text shown as a tooltip when user hovers the mouse over the button." }, { "name": "disabled", "type": "boolean", "description": "Whether the button is disabled." } ], "returns": { "$ref": "Button" } } ], "events": [ { "name": "onSearch", "unsupported": true, "description": "Fired upon a search action (start of a new search, search result navigation, or search being canceled).", "parameters": [ { "name": "action", "type": "string", "description": "Type of search action being performed." }, { "name": "queryString", "type": "string", "optional": true, "description": "Query string (only for 'performSearch')." } ] }, { "name": "onShown", "type": "function", "description": "Fired when the user switches to the panel.", "parameters": [ { "name": "window", "type": "object", "isInstanceOf": "global", "additionalProperties": { "type": "any" }, "description": "The JavaScript window object of panel's page." } ] }, { "name": "onHidden", "type": "function", "description": "Fired when the user switches away from the panel." } ] }, { "id": "ExtensionSidebarPane", "type": "object", "description": "A sidebar created by the extension.", "functions": [ { "name": "setHeight", "unsupported": true, "type": "function", "description": "Sets the height of the sidebar.", "parameters": [ { "name": "height", "type": "string", "description": "A CSS-like size specification, such as '100px' or '12ex'." } ] }, { "name": "setExpression", "async": "callback", "type": "function", "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.", "parameters": [ { "name": "expression", "type": "string", "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." }, { "name": "rootTitle", "type": "string", "optional": true, "description": "An optional title for the root of the expression tree." }, { "name": "callback", "type": "function", "optional": true, "description": "A callback invoked after the sidebar pane is updated with the expression evaluation results." } ] }, { "name": "setObject", "async": "callback", "type": "function", "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.", "parameters": [ { "name": "jsonObject", "type": "string", "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)." }, { "name": "rootTitle", "type": "string", "optional": true, "description": "An optional title for the root of the expression tree." }, { "name": "callback", "type": "function", "optional": true, "description": "A callback invoked after the sidebar is updated with the object." } ] }, { "name": "setPage", "type": "function", "async": true, "description": "Sets an HTML page to be displayed in the sidebar pane.", "parameters": [ { "name": "path", "$ref": "manifest.ExtensionURL", "description": "Relative path of an extension page to display within the sidebar." } ] } ], "events": [ { "name": "onShown", "type": "function", "description": "Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it.", "parameters": [ { "name": "window", "type": "object", "isInstanceOf": "global", "additionalProperties": { "type": "any" }, "description": "The JavaScript window object of the sidebar page, if one was set with the setPage() method." } ] }, { "name": "onHidden", "type": "function", "description": "Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane." } ] }, { "id": "Button", "type": "object", "description": "A button created by the extension.", "functions": [ { "name": "update", "unsupported": true, "type": "function", "description": "Updates the attributes of the button. If some of the arguments are omitted or null, the corresponding attributes are not updated.", "parameters": [ { "name": "iconPath", "type": "string", "optional": true, "description": "Path to the new icon of the button." }, { "name": "tooltipText", "type": "string", "optional": true, "description": "Text shown as a tooltip when user hovers the mouse over the button." }, { "name": "disabled", "type": "boolean", "optional": true, "description": "Whether the button is disabled." } ] } ], "events": [ { "name": "onClicked", "unsupported": true, "type": "function", "description": "Fired when the button is clicked." } ] } ], "properties": { "elements": { "$ref": "ElementsPanel", "description": "Elements panel." }, "sources": { "$ref": "SourcesPanel", "description": "Sources panel." }, "themeName": { "type": "string", "description": "The name of the current devtools theme." } }, "functions": [ { "name": "create", "type": "function", "description": "Creates an extension panel.", "async": "callback", "parameters": [ { "name": "title", "type": "string", "description": "Title that is displayed next to the extension icon in the Developer Tools toolbar." }, { "name": "iconPath", "description": "Path of the panel's icon relative to the extension directory, or an empty string to use the default extension icon as the panel icon.", "choices": [ { "type": "string", "enum": [""] }, { "$ref": "manifest.ExtensionURL" } ] }, { "name": "pagePath", "$ref": "manifest.ExtensionURL", "description": "Path of the panel's HTML page relative to the extension directory." }, { "name": "callback", "type": "function", "optional": true, "description": "A function that is called when the panel is created.", "parameters": [ { "name": "panel", "description": "An ExtensionPanel object representing the created panel.", "$ref": "ExtensionPanel" } ] } ] }, { "name": "setOpenResourceHandler", "unsupported": true, "type": "function", "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.", "async": "callback", "parameters": [ { "name": "callback", "type": "function", "optional": true, "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.", "parameters": [ { "name": "resource", "$ref": "devtools.inspectedWindow.Resource", "description": "A $(ref:devtools.inspectedWindow.Resource) object for the resource that was clicked." } ] } ] }, { "name": "openResource", "unsupported": true, "type": "function", "description": "Requests DevTools to open a URL in a Developer Tools panel.", "async": "callback", "parameters": [ { "name": "url", "type": "string", "description": "The URL of the resource to open." }, { "name": "lineNumber", "type": "integer", "description": "Specifies the line number to scroll to when the resource is loaded." }, { "name": "callback", "type": "function", "optional": true, "description": "A function that is called when the resource has been successfully loaded." } ] } ], "events": [ { "name": "onThemeChanged", "type": "function", "description": "Fired when the devtools theme changes.", "parameters": [ { "name": "themeName", "type": "string", "description": "The name of the current devtools theme." } ] } ] } ]