diff options
Diffstat (limited to 'chrome/common/extensions/api/extension_api.json')
-rwxr-xr-x | chrome/common/extensions/api/extension_api.json | 195 |
1 files changed, 176 insertions, 19 deletions
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index b2c30a3..759d17a 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -1,4 +1,75 @@ +// Copyright (c) 2009 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. + +/* + * This file defines the extensions api functions, events and types. It is + * json-structured list of api "modules". Each module has + * + * namespace: "<apiname>", // i.e. "windows" which becomes visible to + * // extensions as chrome.windows. + * + * types: [], // a list of json schemas which define "types" + * // that are common to that module. i.e. "Tab" or + * // "BookmarkTreeNode". + * + * functions: [], // a list of json schemas which define the + * // functions in the current module. i.e. + * // chrome.tabs.getCurrent(). + * + * events: [], // a list of json schemas which define the events + * // which this module defines. i.e. + * // chrome.windows.onCreated. + * + * --Functions Schemas-- + * Each function schema is required to have a + * + * name: "<function name>" + * type: "function" + * description: "..." // this appears in the docs. + * parameters: [] + * + * |parameters| is a list of json schemas which define the list of parameters + * this function requires and will be validated against. Each parameter + * should define a "name" property, and "description" property, both of which + * will appear in the docs. The final parameter may be a type: "function" + * which is expected to be the callback for this call. That parameter, should + * itself be named ("name": "callback"), have a "parameters" member that + * is a list of the json schemas that define the types that the callback + * sends. Callback parameters should also have "name" and "description" + * properties. + * + * --Event Schemas-- + * Each event schema is also a type: "function" schema that is named. It's + * structure is the same as the callback functions for module Functions. + * It should have a "name", "description", and a "parameters" describing + * the set of arguments it sends. + * + * --Referenced Types-- + * The "types": [] list may contain a list of types that are common to the + * current api module. Each type should have an "id" member ("id": "Tab"). + * These types can be referenced from a schema with "$ref": "<idName>". + * i.e. + * + * ... + * type: "function", + * parameters: [ + * {$ref: "BookmarkTreeNode", name: "node"} + * ] + * + * WARNING: Do not use these referenced types in module function parameters. + * They are not yet properly validated. They are currently safe to use in + * callback parameters and event parameters. + * + * TODO(rafaelw): Validate callback arguments in debug and unittests + * TODO(rafaelw): Validate event arguments in debug and unittests + * TODO(rafaelw): Support $ref for json_schema validation. + */ + [ + /** + * chrome.windows + */ { namespace: "windows", types: [], @@ -113,9 +184,27 @@ } ] }, + + /** + * chrome.tabs + */ { namespace: "tabs", - types: [], + types: [ + { + id: "Tab", + type: "object", + properties: { + id: {type: "integer", minimum: 0}, + index: {type: "integer", minimum: 0}, + windowId: {type: "integer", minimum: 0}, + selected: {type: "boolean"}, + url: {type: "string"}, + title: {type: "string", optional: true}, + favIconUrl: {type: "string", optional: true} + } + } + ], functions: [ { name: "get", @@ -123,7 +212,13 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "function", name: "callback"} + { + type: "function", + name: "callback", + parameters: [ + {name: "tab", $ref: "Tab"} + ] + } ] }, { @@ -132,7 +227,13 @@ description: "", parameters: [ {type: "integer", name: "windowId", minimum: 0, optional: true}, - {type: "function", name: "callback"} + { + type: "function", + name: "callback", + parameters: [ + {name: "tab", $ref: "Tab"} + ] + } ] }, { @@ -159,7 +260,14 @@ selected: {type: "boolean", optional: true} } }, - {type: "function", name: "callback", optional: true} + { + type: "function", + name: "callback", + optional: true, + parameters: [ + {name: "tab", $ref: "Tab"} + ] + } ] }, { @@ -176,7 +284,7 @@ selected: {type: "boolean", optional: true} } }, - {type: "function", name: "callback", optional: true} + {type: "function", name: "callback", optional: true, parameters: []} ] }, { @@ -193,7 +301,7 @@ index: {type: "integer", minimum: 0} } }, - {type: "function", name: "callback", optional: true} + {type: "function", name: "callback", optional: true, parameters: []} ] }, { @@ -202,7 +310,7 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0, optional: true}, - {type: "function", name: "callback", optional: true} + {type: "function", name: "callback", optional: true, parameters: []} ] }, { @@ -211,7 +319,13 @@ description: "detect language of tab.", parameters: [ {type: "integer", name: "tabId", minimum: 0, optional: true}, - {type: "function", name: "callback"} + { + type: "function", + name: "callback", + parameters: [ + {type: "string", name: "language"} + ] + } ] } ], @@ -221,7 +335,7 @@ type: "function", description: "", parameters: [ - {type: "Object", name: "Tab"} + {$ref: "Tab", name: "tab"} ] }, { @@ -230,7 +344,15 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "Object", name: "ChangedProps"} + { + type: "object", + name: "ChangedProps", + properties: { + tabId: {type: "integer", name: "tabId", minimum: 0}, + status: {type: "string"}, + url: {type: "string", optional: true} + } + } ] }, { @@ -239,7 +361,15 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "Object", name: "MoveInfo"} + { + type: "object", + name: "MoveInfo", + properties: { + windowId: {type: "integer", minimum: 0}, + fromIndex: {type: "integer", minimum: 0}, + toIndex: {type: "integer", minimum: 0} + } + } ] }, { @@ -248,7 +378,12 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "Object", name: "SelectionInfo"} + { + type: "object", name: "SelectInfo", + properties: { + windowId: {type: "integer", minimum: 0}, + } + } ] }, { @@ -257,7 +392,14 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "Object", name: "AttachInfo"} + { + type: "object", + name: "AttachInfo", + properties: { + newWindowId: {type: "integer", minimum: 0}, + newPosition: {type: "integer", minimum: 0} + } + } ] }, { @@ -266,7 +408,14 @@ description: "", parameters: [ {type: "integer", name: "tabId", minimum: 0}, - {type: "Object", name: "DetachInfo"} + { + type: "object", + name: "DetachInfo", + properties: { + oldWindowId: {type: "integer", minimum: 0}, + oldPosition: {type: "integer", minimum: 0} + } + } ] }, { @@ -279,6 +428,10 @@ } ] }, + + /** + * chrome.pageActions + */ { namespace: "pageActions", types: [], @@ -323,6 +476,10 @@ events: [ ] }, + + /** + * chrome.bookmarks + */ { namespace: "bookmarks", types: [], @@ -428,7 +585,7 @@ parameters: [ {type: "integer", name: "id", minimum: 0}, { - type: "Object", + type: "object", name: "bookmark", } ] @@ -440,7 +597,7 @@ parameters: [ {type: "integer", name: "id", minimum: 0}, { - type: "Object", + type: "object", name: "RemoveInfo", } ] @@ -452,7 +609,7 @@ parameters: [ {type: "integer", name: "id", minimum: 0}, { - type: "Object", + type: "object", name: "ChangeInfo", } ] @@ -464,7 +621,7 @@ parameters: [ {type: "integer", name: "id", minimum: 0}, { - type: "Object", + type: "object", name: "MoveInfo", } ] @@ -476,7 +633,7 @@ parameters: [ {type: "integer", name: "id", minimum: 0}, { - type: "Object", + type: "object", name: "childIds", } ] |