// 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",
    "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.",
    "nocompile": true,
    "types": [
      {
        "id": "ElementsPanel",
        "type": "object",
        "description": "Represents the Elements panel.",
        "events": [
          {
            "name": "onSelectionChanged",
            "description": "Fired when an object is selected in the panel."
          }
        ],
        "functions": [
          {
            "name": "createSidebarPane",
            "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",
            "description": "Appends a button to the status bar of the panel.",
            "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",
            "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 <code>window</code> 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",
            "type": "function",
            "description": "Sets the height of the sidebar.",
            "parameters": [
              {
                "name": "height",
                "type": "string",
                "description": "A CSS-like size specification, such as <code>'100px'</code> or <code>'12ex'</code>."
              }
            ]
          },
          {
            "name": "setExpression",
            "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",
            "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",
            "description": "Sets an HTML page to be displayed in the sidebar pane.",
            "parameters": [
              {
                "name": "path",
                "type": "string",
                "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 <code>window</code> object of the sidebar page, if one was set with the <code>setPage()</code> 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",
            "description": "Updates the attributes of the button. If some of the arguments are omitted or <code>null</code>, 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",
            "type": "function",
            "description": "Fired when the button is clicked."
          }
        ]
      }
    ],
    "properties": {
      "elements": {
        "$ref": "ElementsPanel",
        "description": "Elements panel."
      }
    },
    "functions": [
      {
        "name": "create",
        "type": "function",
        "description": "Creates an extension panel.",
        "parameters": [
          {
            "name": "title",
            "type": "string",
            "description": "Title that is displayed next to the extension icon in the Developer Tools toolbar."
          },
          {
            "name": "iconPath",
            "type": "string",
            "description": "Path of the panel's icon relative to the extension directory."
          },
          {
            "name": "pagePath",
            "type": "string",
            "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",
        "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.",
        "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."
              }
            ]
          }
        ]
      }
    ]
  }
]