From bed947625415eb87879a48202a84b8b4bd2f92f1 Mon Sep 17 00:00:00 2001 From: "rafaelw@chromium.org" Date: Mon, 3 Aug 2009 19:27:50 +0000 Subject: Extension docs build script, gyp target and PRESUBMIT.PY check This addeds a mechanism for extension docs to "render" from the api/extension_api.json api "idl", the docs/static file content and the template/ html templates into the static extension docs. It retains the property that extension docs loaded in chrome with file:/// scheme will regenerate if dependent data has changed, but otherwise is static. The build.py script runs test_shell to render the static files. A extension_docs gyp target is defined with appropriate inputs & outputs that will run the build.py A PRESUBMIT.PY check will warn on upload and commit if any files have changed that would require a docs rebuild. Note that the PRESUBMIT.PY checks are not currently being run for git cl upload or git cl dcommit. Review URL: http://codereview.chromium.org/159607 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22300 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/extensions/PRESUBMIT.PY | 62 ++ chrome/common/extensions/api/extension_api.json | 887 ++++++++++----------- chrome/common/extensions/docs/api_index.html | 47 +- chrome/common/extensions/docs/bookmarks.html | 47 +- chrome/common/extensions/docs/build/build.py | 164 ++++ chrome/common/extensions/docs/build/generator.html | 38 + chrome/common/extensions/docs/devguide.html | 47 +- chrome/common/extensions/docs/getstarted.html | 47 +- chrome/common/extensions/docs/index.html | 47 +- .../extensions/docs/js/api_page_generator.js | 49 +- chrome/common/extensions/docs/js/bootstrap.js | 11 + chrome/common/extensions/docs/overview.html | 47 +- chrome/common/extensions/docs/pageActions.html | 47 +- chrome/common/extensions/docs/self.html | 47 +- chrome/common/extensions/docs/tabs.html | 47 +- .../extensions/docs/template/page_shell.html | 14 +- chrome/common/extensions/docs/windows.html | 47 +- 17 files changed, 717 insertions(+), 978 deletions(-) create mode 100755 chrome/common/extensions/PRESUBMIT.PY create mode 100755 chrome/common/extensions/docs/build/build.py create mode 100755 chrome/common/extensions/docs/build/generator.html create mode 100755 chrome/common/extensions/docs/js/bootstrap.js (limited to 'chrome/common/extensions') diff --git a/chrome/common/extensions/PRESUBMIT.PY b/chrome/common/extensions/PRESUBMIT.PY new file mode 100755 index 0000000..f2a2889 --- /dev/null +++ b/chrome/common/extensions/PRESUBMIT.PY @@ -0,0 +1,62 @@ +#!/usr/bin/python2.4 +# Copyright 2009, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import os + +_dependent_dirs = set([ + "chrome/common/extensions/api", + "chrome/common/extensions/docs/build", + "chrome/common/extensions/docs/js", + "chrome/common/extensions/docs/static", + "chrome/common/extensions/docs/template", +]); + +_rebuild_warning = """ +This change modifies file(s) which the extension docs depend on. You must +rebuild the extension docs. + +Build by running the 'extension_docs' build target. + +Be sure to include any modified resulting static file +(/common/extension/docs/*.html) in your final CL. +""" + +def CheckChange(input_api, output_api): + for f in input_api.AffectedFiles(): + dir = os.path.dirname(f.LocalPath()) + if (dir in _dependent_dirs): + return [output_api.PresubmitPromptWarning(_rebuild_warning)] + return [] + +def CheckChangeOnUpload(input_api, output_api): + return CheckChange(input_api, output_api) + +def CheckChangeOnCommit(input_api, output_api): + return CheckChange(input_api, output_api) \ No newline at end of file diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json index 1561a41..6a31dc4 100755 --- a/chrome/common/extensions/api/extension_api.json +++ b/chrome/common/extensions/api/extension_api.json @@ -1,707 +1,620 @@ -// 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: "", // 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: "" - * 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": "". - * 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.self - */ { - namespace: "self", - types: [ + "namespace": "self", + "types": [ { - id: "HTMLWindow", - type: "object" + "id": "HTMLWindow", + "type": "object" } ], - functions: [ - { - name: "getViews", - type: "function", - description: "Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.", - parameters: [], - returns: { - type: "array", - description: "Array of HTMLWindow objects", - items: { $ref: "HTMLWindow" } + "functions": [ + { + "name": "getViews", + "type": "function", + "description": "Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.", + "parameters": [], + "returns": { + "type": "array", + "description": "Array of HTMLWindow objects", + "items": { "$ref": "HTMLWindow" } } - }, + } ], - events: [] + "events": [] }, - - /** - * chrome.windows - */ { - namespace: "windows", - types: [], - functions: [ + "namespace": "windows", + "types": [], + "functions": [ { - name: "get", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0}, - {type: "function", name: "callback"} + "name": "get", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0}, + {"type": "function", "name": "callback"} ] }, { - name: "getCurrent", - type: "function", - description: "", - parameters: [ - {type: "function", name: "callback"} + "name": "getCurrent", + "type": "function", + "description": "", + "parameters": [ + {"type": "function", "name": "callback"} ] }, { - name: "getLastFocused", - type: "function", - description: "", - parameters: [ - {type: "function", name: "callback"} + "name": "getLastFocused", + "type": "function", + "description": "", + "parameters": [ + {"type": "function", "name": "callback"} ] }, { - name: "getAll", - type: "function", - description: "", - parameters: [ - {type: "boolean", name: "populate", optional: true}, - {type: "function", name: "callback"} + "name": "getAll", + "type": "function", + "description": "", + "parameters": [ + {"type": "boolean", "name": "populate", "optional": true}, + {"type": "function", "name": "callback"} ] }, { - name: "create", - type: "function", - description: "", - parameters: [ + "name": "create", + "type": "function", + "description": "", + "parameters": [ { - type: "object", - name: "CreateData", - properties: { - url: {type: "string", optional: true}, - left: {type: "integer", optional: true}, - top: {type: "integer", optional: true}, - width: {type: "integer", minimum: 0, optional: true}, - height: {type: "integer", minimum: 0, optional: true} + "type": "object", + "name": "CreateData", + "properties": { + "url": {"type": "string", "optional": true}, + "left": {"type": "integer", "optional": true}, + "top": {"type": "integer", "optional": true}, + "width": {"type": "integer", "minimum": 0, "optional": true}, + "height": {"type": "integer", "minimum": 0, "optional": true} }, - optional: true + "optional": true }, - {type: "function", name: "callback", optional: true} + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "update", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0}, + "name": "update", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0}, { - type: "object", - name: "UpdateInfo", - properties: { - left: {type: "integer", optional: true}, - top: {type: "integer", optional: true}, - width: {type: "integer", minimum: 0, optional: true}, - height: {type: "integer", minimum: 0, optional: true} - }, + "type": "object", + "name": "UpdateInfo", + "properties": { + "left": {"type": "integer", "optional": true}, + "top": {"type": "integer", "optional": true}, + "width": {"type": "integer", "minimum": 0, "optional": true}, + "height": {"type": "integer", "minimum": 0, "optional": true} + } }, - {type: "function", name: "callback", optional: true} + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "remove", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0}, - {type: "function", name: "callback", optional: true} + "name": "remove", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0}, + {"type": "function", "name": "callback", "optional": true} ] - }, + } ], - events: [ + "events": [ { - name: "onCreated", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0} + "name": "onCreated", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0} ] }, { - name: "onRemoved", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0} + "name": "onRemoved", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0} ] }, { - name: "onFocusChanged", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0} + "name": "onFocusChanged", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0} ] } ] }, - - /** - * chrome.tabs - */ { - namespace: "tabs", - 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} + "namespace": "tabs", + "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} } }, { - id: "Port", - type: "object", - properties: { - name: {type: "string"}, - onDisconnect: {type: "object"}, - onMessage: {type: "object"} + "id": "Port", + "type": "object", + "properties": { + "name": {"type": "string"}, + "onDisconnect": {"type": "object"}, + "onMessage": {"type": "object"} } } ], - functions: [ + "functions": [ { - name: "get", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "get", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "function", - name: "callback", - parameters: [ - {name: "tab", $ref: "Tab"} + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tab", "$ref": "Tab"} ] } ] }, { - name: "connect", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", optional: true, minimum: 0}, - {type: "string", name: "name", optional: true} + "name": "connect", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "optional": true, "minimum": 0}, + {"type": "string", "name": "name", "optional": true} ], - returns: { - name: "Port", - $ref: "Port" + "returns": { + "name": "Port", + "$ref": "Port" } }, { - name: "getSelected", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0, optional: true}, + "name": "getSelected", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0, "optional": true}, { - type: "function", - name: "callback", - parameters: [ - {name: "tab", $ref: "Tab"} + "type": "function", + "name": "callback", + "parameters": [ + {"name": "tab", "$ref": "Tab"} ] } ] }, { - name: "getAllInWindow", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "windowId", minimum: 0, optional: true}, - {type: "function", name: "callback"} + "name": "getAllInWindow", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "windowId", "minimum": 0, "optional": true}, + {"type": "function", "name": "callback"} ] }, { - name: "create", - type: "function", - description: "", - parameters: [ + "name": "create", + "type": "function", + "description": "", + "parameters": [ { - type: "object", - name: "CreateProperties", - properties: { - windowId: {type: "integer", minimum: 0, optional: true}, - index: {type: "integer", minimum: 0, optional: true}, - url: {type: "string", optional: true}, - selected: {type: "boolean", optional: true} + "type": "object", + "name": "CreateProperties", + "properties": { + "windowId": {"type": "integer", "minimum": 0, "optional": true}, + "index": {"type": "integer", "minimum": 0, "optional": true}, + "url": {"type": "string", "optional": true}, + "selected": {"type": "boolean", "optional": true} } }, { - type: "function", - name: "callback", - optional: true, - parameters: [ - {name: "tab", $ref: "Tab"} + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + {"name": "tab", "$ref": "Tab"} ] } ] }, { - name: "update", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "update", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "UpdateProperties", - properties: { - url: {type: "string", optional: true}, - selected: {type: "boolean", optional: true} + "type": "object", + "name": "UpdateProperties", + "properties": { + "url": {"type": "string", "optional": true}, + "selected": {"type": "boolean", "optional": true} } }, - {type: "function", name: "callback", optional: true, parameters: []} + {"type": "function", "name": "callback", "optional": true, "parameters": []} ] }, { - name: "move", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "move", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "MoveProperties", - properties: { - windowId: {type: "integer", minimum: 0, optional: true}, - index: {type: "integer", minimum: 0} + "type": "object", + "name": "MoveProperties", + "properties": { + "windowId": {"type": "integer", "minimum": 0, "optional": true}, + "index": {"type": "integer", "minimum": 0} } }, - {type: "function", name: "callback", optional: true, parameters: []} + {"type": "function", "name": "callback", "optional": true, "parameters": []} ] }, { - name: "remove", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0, optional: true}, - {type: "function", name: "callback", optional: true, parameters: []} + "name": "remove", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0, "optional": true}, + {"type": "function", "name": "callback", "optional": true, "parameters": []} ] }, { - name: "detectLanguage", - type: "function", - description: "detect language of tab.", - parameters: [ - {type: "integer", name: "tabId", minimum: 0, optional: true}, + "name": "detectLanguage", + "type": "function", + "description": "detect language of tab.", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0, "optional": true}, { - type: "function", - name: "callback", - parameters: [ - {type: "string", name: "language"} + "type": "function", + "name": "callback", + "parameters": [ + {"type": "string", "name": "language"} ] } ] } ], - events: [ + "events": [ { - name: "onCreated", - type: "function", - description: "", - parameters: [ - {$ref: "Tab", name: "tab"} + "name": "onCreated", + "type": "function", + "description": "", + "parameters": [ + {"$ref": "Tab", "name": "tab"} ] }, { - name: "onUpdated", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "onUpdated", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "ChangedProps", - properties: { - tabId: {type: "integer", name: "tabId", minimum: 0}, - status: {type: "string"}, - url: {type: "string", optional: true} + "type": "object", + "name": "ChangedProps", + "properties": { + "tabId": {"type": "integer", "name": "tabId", "minimum": 0}, + "status": {"type": "string"}, + "url": {"type": "string", "optional": true} } } ] }, { - name: "onMoved", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "onMoved", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "MoveInfo", - properties: { - windowId: {type: "integer", minimum: 0}, - fromIndex: {type: "integer", minimum: 0}, - toIndex: {type: "integer", minimum: 0} + "type": "object", + "name": "MoveInfo", + "properties": { + "windowId": {"type": "integer", "minimum": 0}, + "fromIndex": {"type": "integer", "minimum": 0}, + "toIndex": {"type": "integer", "minimum": 0} } } ] }, { - name: "onSelectionChanged", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "onSelectionChanged", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", name: "SelectInfo", - properties: { - windowId: {type: "integer", minimum: 0}, + "type": "object", "name": "SelectInfo", + "properties": { + "windowId": {"type": "integer", "minimum": 0} } } ] }, { - name: "onAttached", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "onAttached", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "AttachInfo", - properties: { - newWindowId: {type: "integer", minimum: 0}, - newPosition: {type: "integer", minimum: 0} + "type": "object", + "name": "AttachInfo", + "properties": { + "newWindowId": {"type": "integer", "minimum": 0}, + "newPosition": {"type": "integer", "minimum": 0} } } ] }, { - name: "onDetached", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0}, + "name": "onDetached", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0}, { - type: "object", - name: "DetachInfo", - properties: { - oldWindowId: {type: "integer", minimum: 0}, - oldPosition: {type: "integer", minimum: 0} + "type": "object", + "name": "DetachInfo", + "properties": { + "oldWindowId": {"type": "integer", "minimum": 0}, + "oldPosition": {"type": "integer", "minimum": 0} } } ] }, { - name: "onRemoved", - type: "function", - description: "", - parameters: [ - {type: "integer", name: "tabId", minimum: 0} + "name": "onRemoved", + "type": "function", + "description": "", + "parameters": [ + {"type": "integer", "name": "tabId", "minimum": 0} ] } ] }, - - /** - * chrome.pageActions - */ { - namespace: "pageActions", - types: [], - functions: [ - { - name: "enableForTab", - type: "function", - description: "", - parameters: [ - {type: "string", name: "pageActionId"}, + "namespace": "pageActions", + "types": [], + "functions": [ + { + "name": "enableForTab", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "pageActionId"}, { - type: "object", - name: "action", - properties: { - tabId: {type: "integer", minimum: 0}, - url: {type: "string"}, - title: {type: "string", optional: true}, - iconId: {type: "integer", minimum: 0, optional: true} + "type": "object", + "name": "action", + "properties": { + "tabId": {"type": "integer", "minimum": 0}, + "url": {"type": "string"}, + "title": {"type": "string", "optional": true}, + "iconId": {"type": "integer", "minimum": 0, "optional": true} }, - optional: false + "optional": false } ] }, { - name: "disableForTab", - type: "function", - description: "", - parameters: [ - {type: "string", name: "pageActionId"}, + "name": "disableForTab", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "pageActionId"}, { - type: "object", - name: "action", - properties: { - tabId: {type: "integer", minimum: 0}, - url: {type: "string"} + "type": "object", + "name": "action", + "properties": { + "tabId": {"type": "integer", "minimum": 0}, + "url": {"type": "string"} }, - optional: false + "optional": false } ] } ], - events: [ + "events": [ ] }, - - /** - * chrome.bookmarks - */ { - namespace: "bookmarks", - types: [], - functions: [ - { - name: "get", - type: "function", - description: "", - parameters: [ + "namespace": "bookmarks", + "types": [], + "functions": [ + { + "name": "get", + "type": "function", + "description": "", + "parameters": [ { - name: "idOrIdList", - choice : [ - {type: "string"}, - {type: "array", items: {type: "string"}, minItems: 1} + "name": "idOrIdList", + "choice": [ + {"type": "string"}, + {"type": "array", "items": {"type": "string"}, "minItems": 1} ] }, - {type: "function", name: "callback"} + {"type": "function", "name": "callback"} ] }, { - name: "getChildren", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, - {type: "function", name: "callback"} + "name": "getChildren", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, + {"type": "function", "name": "callback"} ] }, { - name: "getTree", - type: "function", - description: "", - parameters: [ - {type: "function", name: "callback"} + "name": "getTree", + "type": "function", + "description": "", + "parameters": [ + {"type": "function", "name": "callback"} ] }, { - name: "search", - type: "function", - description: "", - parameters: [ - {type: "string", name: "query"}, - {type: "function", name: "callback"} + "name": "search", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "query"}, + {"type": "function", "name": "callback"} ] }, { - name: "create", - type: "function", - description: "", - parameters: [ + "name": "create", + "type": "function", + "description": "", + "parameters": [ { - type: "object", - name: "bookmark", - properties: { - parentId: {type: "string"}, - index: {type: "integer", minimum: 0, optional: true}, - title: {type: "string", optional: true}, - url: {type: "string", optional: true}, + "type": "object", + "name": "bookmark", + "properties": { + "parentId": {"type": "string"}, + "index": {"type": "integer", "minimum": 0, "optional": true}, + "title": {"type": "string", "optional": true}, + "url": {"type": "string", "optional": true} } }, - {type: "function", name: "callback", optional: true} + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "move", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "move", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "destination", - properties: { - parentId: {type: "string"}, - index: {type: "integer", minimum: 0, optional: true} + "type": "object", + "name": "destination", + "properties": { + "parentId": {"type": "string"}, + "index": {"type": "integer", "minimum": 0, "optional": true} } }, - {type: "function", name: "callback", optional: true} + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "update", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "update", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "changes", - properties: { - title: {type: "string", optional: true} + "type": "object", + "name": "changes", + "properties": { + "title": {"type": "string", "optional": true} } }, - {type: "function", name: "callback", optional: true} + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "remove", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, - {type: "function", name: "callback", optional: true} + "name": "remove", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, + {"type": "function", "name": "callback", "optional": true} ] }, { - name: "removeTree", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, - {type: "function", name: "callback", optional: true} + "name": "removeTree", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, + {"type": "function", "name": "callback", "optional": true} ] - }, + } ], - events: [ + "events": [ { - name: "onAdded", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "onAdded", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "bookmark", + "type": "object", + "name": "bookmark" } ] }, { - name: "onRemoved", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "onRemoved", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "RemoveInfo", + "type": "object", + "name": "RemoveInfo" } ] }, { - name: "onChanged", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "onChanged", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "ChangeInfo", + "type": "object", + "name": "ChangeInfo" } ] }, { - name: "onMoved", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "onMoved", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "MoveInfo", + "type": "object", + "name": "MoveInfo" } ] }, { - name: "onChildrenReordered", - type: "function", - description: "", - parameters: [ - {type: "string", name: "id"}, + "name": "onChildrenReordered", + "type": "function", + "description": "", + "parameters": [ + {"type": "string", "name": "id"}, { - type: "object", - name: "childIds", + "type": "object", + "name": "childIds" } ] } diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html index faf8a37..c5db1df 100755 --- a/chrome/common/extensions/docs/api_index.html +++ b/chrome/common/extensions/docs/api_index.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + api_index

[PENDING: links to reference doc — for example, chrome.* APIs — go here.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

diff --git a/chrome/common/extensions/docs/bookmarks.html b/chrome/common/extensions/docs/bookmarks.html index faf8a37..59f3234 100755 --- a/chrome/common/extensions/docs/bookmarks.html +++ b/chrome/common/extensions/docs/bookmarks.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + chrome.bookmarks API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getChildren
    3. getTree
    4. search
    5. create
    6. move
    7. update
    8. remove
    9. removeTree
  3. Events
    1. onAdded
    2. onRemoved
    3. onChanged
    4. onMoved
    5. onChildrenReordered
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks.

Description

[PENDING: intro goes here...]

Bookmark objects are an important part of the chrome.bookmarks API. Each bookmark object represents either a URL or a group of bookmarks, as you can see in the following figure.

2 kinds of bookmark objects

Properties

Objects that represent bookmarks can have the following properties:

id
An integer ID that's unique for each bookmark. Don't save this ID in persistent storage; the ID for a particular bookmark might change the next time the browser is started.
title
The name of the bookmark. This is the user-visible string that describes the URL or group.
parentId (omitted for the root group)
The ID of the group that this bookmark is in.
index (optional; omitted for the root group)
The 0-based integer position of the bookmark within its group.
url (omitted for groups)
The URL of the page that the bookmark points to.

Examples

The following code creates a bookmark group with the title "Chromium bookmarks". The last argument defines a function to be executed after the folder is created.

chrome.bookmarks.create({'parentId': bookmarkBar.id, 'title': 'Chromium bookmarks'}, function(newFolder) {...}); 

The next snippet creates a bookmark pointing to the Chromium developer doc. Since nothing too bad will happen if creating the bookmark fails, this snippet doesn't bother to define a callback function.

chrome.bookmarks.create({'parentId': chromiumBookmarks.id, 'title': 'dev doc', 'url': 'http://dev.chromium.org'}); 

Say you have bookmark hierarchy that looks like this:

  • Bookmarks
    • Google
      • Apps
        • ...
        • ...
        • ...
      • Google homepage
    • Example

Here's how those bookmarks might be represented with bookmark objects:

a hierarchy of bookmarks

Here's some code you could use to create that hierarchy:

...code goes here... 

Methods

get

void chrome.bookmarks.get(, string or array of string idOrIdList, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

idOrIdList (string or array of string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getChildren

void chrome.bookmarks.getChildren(, string id, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getTree

void chrome.bookmarks.getTree(, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

search

void chrome.bookmarks.search(, string query, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

query (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.bookmarks.create(, object bookmark, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

bookmark (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

move

void chrome.bookmarks.move(, string id, object destination, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
destination (object)
Undocumented.
Description of this parameter from the json schema.
parentId (string)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.bookmarks.update(, string id, object changes, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
changes (object)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.bookmarks.remove(, string id, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

removeTree

void chrome.bookmarks.removeTree(, string id, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onAdded

chrome.bookmarks.onAdded.addListener(function(string id, object bookmark) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
bookmark (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(string id, object RemoveInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
RemoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onChanged

chrome.bookmarks.onChanged.addListener(function(string id, object ChangeInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangeInfo (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onMoved

chrome.bookmarks.onMoved.addListener(function(string id, object MoveInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onChildrenReordered

chrome.bookmarks.onChildrenReordered.addListener(function(string id, object childIds) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

id (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
childIds (object)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/build/build.py b/chrome/common/extensions/docs/build/build.py new file mode 100755 index 0000000..c9ea4dd --- /dev/null +++ b/chrome/common/extensions/docs/build/build.py @@ -0,0 +1,164 @@ +#!/usr/bin/python +# 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. + +"""Docbuilder for extension docs.""" + +import os +import os.path +import shutil +import sys + +from subprocess import Popen, PIPE +from optparse import OptionParser + +_script_path = os.path.realpath(__file__) +_build_dir = os.path.dirname(_script_path) +_base_dir = os.path.normpath(_build_dir + "/..") +_static_dir = _base_dir + "/static" +_js_dir = _base_dir + "/js" +_template_dir = _base_dir + "/template" +_extension_api_dir = os.path.normpath(_base_dir + "/../api") + +_extension_api_json = _extension_api_dir + "/extension_api.json" +_api_template_html = _template_dir + "/api_template.html" +_page_shell_html = _template_dir + "/page_shell.html" +_generator_html = _build_dir + "/generator.html" + +_expected_output_preamble = "" + +# HACK! This is required because we can only depend on python 2.4 and +# the calling environment may not be setup to set the PYTHONPATH +sys.path.append(os.path.normpath(_base_dir + + "/../../../../third_party/simplejson")) +import simplejson as json + +def RenderPage(name, test_shell): + """ + Calls test_shell --layout-tests .../generator.html? and writes the + result to .../docs/.html + """ + + if not name: + raise Exception("RenderPage called with empty name"); + + generator_url = _generator_html + "?" + name + output_file = _base_dir + "/" + name + ".html" + + # Copy page_shell to destination output; + if (os.path.isfile(output_file)): + os.remove(output_file) + + shutil.copy(_page_shell_html, output_file) + + # Run test_shell and capture result + p = Popen([test_shell, "--layout-tests", generator_url], shell=True, + stdout=PIPE) + + # first output line is url that was processed by test_shell + p.stdout.readline() + + # second output line is the layoutTestShell.dumpText() value. + result = p.stdout.readline() + if (not result.startswith(_expected_output_preamble)): + raise Exception("test_shell returned unexpected output: " + result); + + # Rewrite result + os.remove(output_file) + open(output_file, 'w').write(result) + +def FindTestShell(product_dir): + search_locations = [] + + if (sys.platform in ('cygwin', 'win32')): + search_locations.append(product_dir + "/test_shell.exe") + + if (sys.platform in ('linux', 'linux2')): + search_locations.append(product_dir + "/test_shell") + + if (sys.platform == 'darwin'): + search_locations.append(product_dir + + "/TestShell.app/Contents/MacOS/TestShell") + + for loc in search_locations: + if os.path.isfile(loc): + return loc + + print ("Failed to find test_shell executable in: \n" + + "\n".join(search_locations)) + + raise Exception('Could not find test_shell executable.') + +def GetRelativePath(path): + return os.path.normpath(path)[len(os.getcwd()) + 1:] + +def GetAPIModuleNames(): + contents = open(_extension_api_json, 'r').read(); + extension_api = json.loads(contents, encoding="ASCII") + return set( module['namespace'].encode() for module in extension_api) + +def GetStaticFileNames(): + static_files = os.listdir(_static_dir) + return set(os.path.splitext(file)[0] + for file in static_files + if file.endswith(".html")) + +def GetInputFiles(): + input_files = []; + + input_files.append(GetRelativePath(_api_template_html)); + input_files.append(GetRelativePath(_page_shell_html)); + input_files.append(GetRelativePath(_generator_html)); + input_files.append(GetRelativePath(_script_path)); + input_files.append(GetRelativePath(_extension_api_json)); + # static files + input_files += [GetRelativePath(_static_dir + "/" + name + ".html") + for name in GetStaticFileNames()] + # js files + input_files += [GetRelativePath(_js_dir + "/" + file) + for file in os.listdir(_js_dir)] + return input_files + +def GetOutputFiles(): + page_names = GetAPIModuleNames() | GetStaticFileNames() + return [GetRelativePath(_base_dir + "/" + name + ".html") + for name in page_names] + +def main(): + parser = OptionParser() + parser.add_option("--list-inputs", action="store_true", dest="list_inputs") + parser.add_option("--list-outputs", action="store_true", dest="list_outputs") + parser.add_option("--product-dir", dest="product_dir") + + (options, args) = parser.parse_args() + + # Return input list to gyp build target + if (options.list_inputs): + for f in GetInputFiles(): + print f + return 0; + # Return output list to gyp build target + if (options.list_outputs): + for f in GetOutputFiles(): + print f + return 0; + + test_shell = FindTestShell(options.product_dir) + + # Read static file names + static_names = GetStaticFileNames() + + # Read module names + module_names = GetAPIModuleNames() + + # All pages to generate + page_names = static_names | module_names + + for page in page_names: + RenderPage(page, test_shell); + + return 0; + +if __name__ == '__main__': + sys.exit(main()) \ No newline at end of file diff --git a/chrome/common/extensions/docs/build/generator.html b/chrome/common/extensions/docs/build/generator.html new file mode 100755 index 0000000..7e82e0e --- /dev/null +++ b/chrome/common/extensions/docs/build/generator.html @@ -0,0 +1,38 @@ + + + + + + + \ No newline at end of file diff --git a/chrome/common/extensions/docs/devguide.html b/chrome/common/extensions/docs/devguide.html index faf8a37..e96797b 100755 --- a/chrome/common/extensions/docs/devguide.html +++ b/chrome/common/extensions/docs/devguide.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + devguide

[PENDING: intro to the guide goes here. say where to go. lots o' links.]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html index faf8a37..b4d001d 100755 --- a/chrome/common/extensions/docs/getstarted.html +++ b/chrome/common/extensions/docs/getstarted.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + getstarted

This tutorial walks you through creating a simple extension. To complete this tutorial, you must have Windows; Linux and Mac don't yet support extensions.

Get your browser ready

To develop extensions for Google Chrome, you need to set up your browser:

  1. Subscribe to the Dev channel of Google Chrome for Windows.
  2. Create a separate profile for testing (optional but highly recommended). Having a testing profile means that you can use Google Chrome (with your default profile) for everyday browsing, even if your extension has horrible bugs.

Create and load an extension

In this section, you'll write a toolstrip — an extension that puts a bit of UI into the toolbar at the bottom of the Google Chrome window.

  1. Create a folder somewhere on your computer to contain your extension's code. We'll assume the folder is located at c:\myext, but it can be anywhere.
  2. Inside your extension's folder, create a text file called manifest.json, and put this in it:
    { "name": "My First Extension", "version": "1.0", "description": "The first extension that I made.", "toolstrips": [ "my_toolstrip.html" ] }
  3. In the same folder, create a text file called my_toolstrip.html, and put this in it:
    <div class="toolstrip-button"> <span>Hello, World!</span> </div>
  4. Load the extension:
    1. Change the shortcut that you use to start the browser (or create a new one) so that it has the --enable-extensions and --load-extension flags. For example, if your extension is at c:\myext, your shortcut might look something like this:
      chrome.exe --enable-extensions --load-extension="c:\myext"
    2. Exit Google Chrome. If you have a separate profile for testing, you only need to exit the browser instances that use the testing profile.
    3. Double-click the shortcut to start the browser.

    Note: For details on changing shortcut properties, see Creating and Using Profiles.

You should see the UI for your extension at the bottom left of the browser, looking something like this:

default appearance initial onhover appearance final onhover appearance

Your extension's button is automatically styled to look like it belongs in the browser. If you put the cursor over the button, the button gets a nice, rounded edge, just like the buttons in the bookmark bar. After a while, a tooltip comes up, identifying the extension.

[PENDING: troubleshooting info should go here. what are symptoms of common typos, including misnamed files? what are the symptoms if you don't have the dev channel?]

Add code to the extension

In this step, you'll make your extension do something besides just look good.

  1. Inside your extension's folder, create a text file called hello_world.html, and add the following code to it:

    CSS and JavaScript code for hello_world
  2. Edit my_toolstrip.html, so that it has the following code:

    <div class="toolstrip-button" onclick="window.open('hello_world.html')"> <span>Hello, World!</span> </div>
  3. Restart the browser to load the new version of the extension.
  4. Click the button. A window should come up that displays hello_world.html.

It should look something like this:

a window with a grid of images related to HELLO WORLD

If you don't see that page, try the instructions again, following them exactly. Don't try loading an HTML file that isn't in the extension's folder — it won't work!

Debug the extension

You can use the browser's built-in developer tools to view your extension's code, display debugging output, and debug your extension.

  1. Edit my_toolstrip.html, so that it has the following code:

    <script> function helloWorld() { var hwFile = 'hello_world.html'; console.log("in helloWorld()"); window.open(hwFile); } </script> <div class="toolstrip-button" onclick="helloWorld();"> <span>Hello, World!</span> </div>

    The relocated code still has the same effect, but now it has some debugging output, thanks to the call to console.log().

  2. Restart the browser, so that it loads your new version of the extension.
  3. Right-click the Hello, World! button (at the bottom left) to bring up the Developer Tools window for this instance of your toolstrip. The window should look something like this:

  4. Click the Scripts button. If necessary, choose my_toolstrip.html from the list of scripts. The result should be something like this:

  5. Set a debugging breakpoint at the window.open() statement by clicking 5 in the left column:

  6. Click the Console button (second from left, at the bottom of the Developer Tools window) so that you can see both the code and the console.

  7. Back in the main browser window, click the Hello, World! button, so that the extension begins executing. You should see the output of console.log() along with the line number, and execution should stop just before the call to window.open().

    The Call Stack area at the right of the tools window shows that the helloWorld() method was called by an anonymous function that was called by onclick. Anywhere in the Call Stack or console that you see a file and line number (for example, "my_toolstrip.html:4"), you can click that text to see the relevant line of code.

  8. In the upper right part of the tools window, scroll down (if necessary) until you can see the local scope variables. This section shows the current values of all variables in the current scope. For example, you can see that hwFile is a local variable that has the value "hello_world.html".

  9. Click the buttons at the upper right of the window to resume execution or to step through the code. Once the call to window.open() returns, the main browser window should open a new tab that displays the contents of hello_world.html.

You now know how to load and debug an extension!

Summary

[PENDING: Summarize what we did, what it means, what else we would've done if this were a real extension (e.g. package it), and where to find more information. Suggest where to go next.]

diff --git a/chrome/common/extensions/docs/index.html b/chrome/common/extensions/docs/index.html index faf8a37..a62689d 100755 --- a/chrome/common/extensions/docs/index.html +++ b/chrome/common/extensions/docs/index.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + index

If you want to customize Google Chrome, you've come to the right place. An extension is a bundle of web code (HTML, JavaScript, perhaps some CSS) that lets you add functionality or a bit of user interface (usually both) to the browser. Examples of extensions include a mail checker, a newsfeed subscriber, and a status monitor.

Contents

This documentation is just being written; here's what we have so far. You might also want to look at Other resources. If you just want to make something, go to Get Started.

Other resources

diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js index e45a5b7..46406be 100755 --- a/chrome/common/extensions/docs/js/api_page_generator.js +++ b/chrome/common/extensions/docs/js/api_page_generator.js @@ -53,7 +53,11 @@ function extend(obj, obj2) { function renderPage() { var pathParts = document.location.href.split(/\/|\./); pageName = pathParts[pathParts.length - 2]; - + if (!pageName) { + alert("Empty page name for: " + document.location.href); + return; + } + // Fetch the api template and insert into the . fetchContent(API_TEMPLATE, function(templateContent) { document.getElementsByTagName("body")[0].innerHTML = templateContent; @@ -68,7 +72,7 @@ function fetchStatic() { fetchContent(staticResource(pageName), function(overviewContent) { document.getElementById("static").innerHTML = overviewContent; fetchSchema(); - + }, function(error) { // Not fatal. Some api pages may not have matching static content. fetchSchema(); @@ -88,6 +92,7 @@ function fetchSchema() { * onSuccess(content) */ function fetchContent(url, onSuccess, onError) { + var localUrl = url; var xhr = new XMLHttpRequest(); var abortTimerId = window.setTimeout(function() { xhr.abort(); @@ -99,7 +104,7 @@ function fetchContent(url, onSuccess, onError) { if (onError) { onError(error); } - console.error("XHR Failed: " + error); + console.error("XHR Failed fetching: " + localUrl + "..." + error); } try { @@ -113,9 +118,9 @@ function fetchContent(url, onSuccess, onError) { } } } - + xhr.onerror = handleError; - + xhr.open("GET", url, true); xhr.send(null); } catch(e) { @@ -134,7 +139,7 @@ function fetchContent(url, onSuccess, onError) { function renderTemplate(schemaContent) { pageData = {}; var schema = JSON.parse(schemaContent); - + schema.each(function(module) { if (module.namespace == pageName) { // This page is an api page. Setup types and apiDefinition. @@ -147,16 +152,24 @@ function renderTemplate(schemaContent) { preprocessApi(pageData, schema); } }); - + setupPageData(pageData, schema); - + // Render to template var input = new JsEvalContext(pageData); var output = document.getElementsByTagName("html")[0]; jstProcess(input, output); - + // Show. document.getElementsByTagName("body")[0].className = ""; + + if (parent && parent.done) + parent.done(); +} + +function serializePage() { + var s = new XMLSerializer(); + return s.serializeToString(document); } function setupPageData(pageData, schema) { @@ -170,7 +183,7 @@ function setupPageData(pageData, schema) { pageData.apiModules.push(m); }); pageData.apiModules.sort(function(a, b) { return a.name > b.name; }); - + if (!pageData.pageTitle) { pageData.pageTitle = pageName; pageData.h1Header = pageName; @@ -203,13 +216,13 @@ function preprocessApi(pageData, schema) { }); } } - + // Setup any type: "object" pameters to have an array of params (rather than // named properties). f.parameters.each(function(param) { addPropertyListIfObject(param); }); - + // Setup return typeName & _propertyList, if any. if (f.returns) { linkTypeReference(f.returns); @@ -217,7 +230,7 @@ function preprocessApi(pageData, schema) { addPropertyListIfObject(f.returns); } }); - + module.events.each(function(e) { linkTypeReferences(e.parameters); assignTypeNames(e.parameters); @@ -274,19 +287,19 @@ function assignTypeNames(parameters) { function typeName(schema) { if (schema.$ref) schema = types[schema.$ref]; - + if (schema.choice) { var typeNames = []; schema.choice.each(function(c) { typeNames.push(typeName(c)); }); - + return typeNames.join(" or "); } - + if (schema.type == "array") return "array of " + typeName(schema.items); - + return schema.type; } @@ -299,6 +312,6 @@ function generateSignatureString(parameters) { parameters.each(function(param, i) { retval.push(param.typeName + " " + param.name); }); - + return retval.join(", "); } \ No newline at end of file diff --git a/chrome/common/extensions/docs/js/bootstrap.js b/chrome/common/extensions/docs/js/bootstrap.js new file mode 100755 index 0000000..5282030d --- /dev/null +++ b/chrome/common/extensions/docs/js/bootstrap.js @@ -0,0 +1,11 @@ +window.onload = function() { + // Regenerate page if we are passed the "?regenerate" search param + // or if the user-agent is chrome AND the document is being served + // from the file:/// scheme. + if (window.location.search == "?regenerate" || + navigator.userAgent.indexOf("Chrome") > -1) { + // Hide body content initially to minimize flashing. + document.getElementsByTagName("body")[0].className = "hidden"; + window.renderPage(); + } +} \ No newline at end of file diff --git a/chrome/common/extensions/docs/overview.html b/chrome/common/extensions/docs/overview.html index faf8a37..07481fb 100755 --- a/chrome/common/extensions/docs/overview.html +++ b/chrome/common/extensions/docs/overview.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + overview

[PENDING: technical overview to be provided]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce sed elit felis. Vestibulum porta mauris eget mi placerat a condimentum leo semper. Ut scelerisque, ipsum in cursus semper, lectus enim molestie ante, a porttitor dolor neque sit amet lorem. Integer dignissim gravida eros ac rhoncus. Curabitur porttitor hendrerit dolor nec aliquam. Ut vulputate ultrices eros eu ultrices. Pellentesque tempor mattis odio in blandit. Proin nulla metus, tristique eget iaculis gravida, varius at leo. Ut dolor mi, auctor et scelerisque vitae, volutpat eleifend magna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi ut risus nec massa consectetur accumsan sed non est. Fusce ornare eros et felis dignissim convallis. Maecenas condimentum purus eget nisl condimentum vitae ornare diam sollicitudin. Nulla et dictum ante. In lacus odio, dapibus vel faucibus at, posuere id enim. Nulla tincidunt felis id lectus convallis vulputate. Phasellus libero dui, posuere sollicitudin egestas eget, blandit in urna. Sed cursus tellus sed diam hendrerit pulvinar.

Nam tincidunt mollis aliquam. Suspendisse bibendum dignissim dui, ac mollis ligula fringilla sit amet. Pellentesque dapibus lobortis dignissim. Cras eu lorem a ligula imperdiet ultricies. Phasellus ipsum mi, accumsan quis dignissim eu, commodo ut mi. Nulla sagittis aliquet malesuada. Ut lobortis tellus vitae dolor venenatis eu ullamcorper lorem gravida. Quisque non pharetra velit. Maecenas elit risus, ultricies in sagittis eget, facilisis sed neque. Quisque feugiat porta pharetra. Vestibulum lorem magna, pellentesque et mattis sit amet, euismod et dui.

Phasellus consectetur dolor auctor mi luctus eu auctor velit aliquam. Donec malesuada laoreet risus, et facilisis massa rhoncus sit amet. Vivamus sit amet fermentum lorem. Morbi nulla quam, ultricies malesuada scelerisque a, convallis vitae nisl. Pellentesque consequat libero sit amet lectus convallis varius. Donec at mi orci. Duis malesuada massa nulla. Nam vel tellus mauris. Suspendisse potenti. Cras euismod, orci volutpat ornare condimentum, eros nibh iaculis lectus, ac euismod nibh eros nec turpis. Nullam at est elit, quis sagittis est.

Donec aliquet, velit in elementum semper, purus metus laoreet nisl, in aliquet nulla erat eu quam. Fusce iaculis, augue quis tristique posuere, massa tortor congue lacus, ac scelerisque velit tortor eget lorem. Praesent in massa enim, fermentum imperdiet ligula. Suspendisse purus sapien, sagittis eu condimentum ut, scelerisque vel purus. Vestibulum ornare faucibus metus eu rutrum. Maecenas convallis felis vitae lorem tincidunt vitae interdum nunc adipiscing. Proin a egestas enim. Proin mattis mollis urna id lobortis. Sed id libero nec purus sollicitudin tristique id vitae purus. Duis rutrum semper mollis. Nam posuere nulla at mi egestas nec auctor mauris pretium. Ut nec quam lectus. Vivamus laoreet ligula ut odio ultricies aliquet. Aliquam erat volutpat. Nunc quis lectus vitae massa consectetur tempus vitae eu mi.

Duis vel nunc ut orci pretium eleifend ac posuere nisi. Curabitur in lorem in sapien lobortis facilisis. Vestibulum varius sapien lacus. Morbi urna sapien, iaculis a mollis eget, pharetra id sapien. Nulla bibendum, tellus non tristique sodales, eros erat elementum nisl, et ultricies velit mauris nec odio. Aliquam nisi turpis, accumsan sit amet condimentum non, volutpat eget arcu. Praesent euismod elementum lorem, in mollis justo lacinia ut. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris aliquet elit sit amet dolor iaculis viverra vehicula magna accumsan. Praesent tempor imperdiet mauris, eu viverra mauris ultricies sed. In quam lacus, porttitor in facilisis id, blandit vel massa. Maecenas rutrum ullamcorper enim eu bibendum. Fusce mauris velit, eleifend vitae consectetur et, condimentum at nunc. Proin id hendrerit turpis.

diff --git a/chrome/common/extensions/docs/pageActions.html b/chrome/common/extensions/docs/pageActions.html index faf8a37..cf89ea9 100755 --- a/chrome/common/extensions/docs/pageActions.html +++ b/chrome/common/extensions/docs/pageActions.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + chrome.pageActions API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. enableForTab
    2. disableForTab
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

enableForTab

void chrome.pageActions.enableForTab(, string pageActionId, object action)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

pageActionId (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
action (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
iconId (optional integer)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

disableForTab

void chrome.pageActions.disableForTab(, string pageActionId, object action)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

pageActionId (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
action (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

diff --git a/chrome/common/extensions/docs/self.html b/chrome/common/extensions/docs/self.html index faf8a37..64524ba 100755 --- a/chrome/common/extensions/docs/self.html +++ b/chrome/common/extensions/docs/self.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + chrome.self API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. getViews
  3. Events
    1. eventName
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

getViews

array of object chrome.self.getViews(, )

Returns an array of the global JavaScript objects for each of the views running inside the current extension. This includes toolstrips, background pages, and tabs.

Parameters

paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

<!--framePath //<!--frame0-->--> (array of object)
Array of HTMLWindow objects
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html index faf8a37..656b986 100755 --- a/chrome/common/extensions/docs/tabs.html +++ b/chrome/common/extensions/docs/tabs.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + chrome.tabs API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. connect
    3. getSelected
    4. getAllInWindow
    5. create
    6. update
    7. move
    8. remove
    9. detectLanguage
  3. Events
    1. onCreated
    2. onUpdated
    3. onMoved
    4. onSelectionChanged
    5. onAttached
    6. onDetached
    7. onRemoved
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.tabs.get(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

connect

object chrome.tabs.connect(, integer tabId, string name)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
name (optional string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

Port (object)
Undocumented.
Description of this parameter from the json schema.
name (string)
Undocumented.
Description of this parameter from the json schema.
onDisconnect (object)
Undocumented.
Description of this parameter from the json schema.
onMessage (object)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getSelected

void chrome.tabs.getSelected(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

getAllInWindow

void chrome.tabs.getAllInWindow(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.tabs.create(, object CreateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

CreateProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (optional integer)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(object tab) {...});
tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.tabs.update(, integer tabId, object UpdateProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateProperties (object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
selected (optional boolean)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

move

void chrome.tabs.move(, integer tabId, object MoveProperties, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveProperties (object)
Undocumented.
Description of this parameter from the json schema.
windowId (optional integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.tabs.remove(, integer tabId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

detectLanguage

void chrome.tabs.detectLanguage(, integer tabId, function callback)

detect language of tab.

Parameters

tabId (optional integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(string language) {...});
language (string)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(object tab) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tab (object)
Undocumented.
Description of this parameter from the json schema.
id (integer)
Undocumented.
Description of this parameter from the json schema.
index (integer)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
selected (boolean)
Undocumented.
Description of this parameter from the json schema.
url (string)
Undocumented.
Description of this parameter from the json schema.
title (optional string)
Undocumented.
Description of this parameter from the json schema.
favIconUrl (optional string)
Undocumented.
Description of this parameter from the json schema.

onUpdated

chrome.bookmarks.onUpdated.addListener(function(integer tabId, object ChangedProps) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
ChangedProps (object)
Undocumented.
Description of this parameter from the json schema.
tabId (integer)
Undocumented.
Description of this parameter from the json schema.
status (string)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.

onMoved

chrome.bookmarks.onMoved.addListener(function(integer tabId, object MoveInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
MoveInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.
fromIndex (integer)
Undocumented.
Description of this parameter from the json schema.
toIndex (integer)
Undocumented.
Description of this parameter from the json schema.

onSelectionChanged

chrome.bookmarks.onSelectionChanged.addListener(function(integer tabId, object SelectInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
SelectInfo (object)
Undocumented.
Description of this parameter from the json schema.
windowId (integer)
Undocumented.
Description of this parameter from the json schema.

onAttached

chrome.bookmarks.onAttached.addListener(function(integer tabId, object AttachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
AttachInfo (object)
Undocumented.
Description of this parameter from the json schema.
newWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
newPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onDetached

chrome.bookmarks.onDetached.addListener(function(integer tabId, object DetachInfo) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
DetachInfo (object)
Undocumented.
Description of this parameter from the json schema.
oldWindowId (integer)
Undocumented.
Description of this parameter from the json schema.
oldPosition (integer)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer tabId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

tabId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
diff --git a/chrome/common/extensions/docs/template/page_shell.html b/chrome/common/extensions/docs/template/page_shell.html index faf8a37..792a9ac 100755 --- a/chrome/common/extensions/docs/template/page_shell.html +++ b/chrome/common/extensions/docs/template/page_shell.html @@ -25,19 +25,7 @@ src="../../../third_party/jstemplate/jstemplate_compiled.js"> - + diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html index faf8a37..223b7f8 100755 --- a/chrome/common/extensions/docs/windows.html +++ b/chrome/common/extensions/docs/windows.html @@ -1,46 +1 @@ - - - - - - - - pageTitle - - - - - - - - - + chrome.windows API Reference

Contents

  1. Description
    1. Properties
    2. Examples
  2. Methods
    1. get
    2. getCurrent
    3. getLastFocused
    4. getAll
    5. create
    6. update
    7. remove
  3. Events
    1. onCreated
    2. onRemoved
    3. onFocusChanged
  4. TODO: Structs
[PENDING: links to all h2s and h3s should go here -- would it be possible to link to overview h3s, as well? if so, how should we create their anchor/id values?]

[PENDING: API Module Overview Goes Here]

Methods

get

void chrome.windows.get(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getCurrent

void chrome.windows.getCurrent(, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getLastFocused

void chrome.windows.getLastFocused(, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

getAll

void chrome.windows.getAll(, boolean populate, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

populate (optional boolean)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

create

void chrome.windows.create(, object CreateData, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

CreateData (optional object)
Undocumented.
Description of this parameter from the json schema.
url (optional string)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

update

void chrome.windows.update(, integer windowId, object UpdateInfo, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
UpdateInfo (object)
Undocumented.
Description of this parameter from the json schema.
left (optional integer)
Undocumented.
Description of this parameter from the json schema.
top (optional integer)
Undocumented.
Description of this parameter from the json schema.
width (optional integer)
Undocumented.
Description of this parameter from the json schema.
height (optional integer)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

remove

void chrome.windows.remove(, integer windowId, function callback)

Undocumented.

A description from the json schema def of the function goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
callback (optional function)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Returns

paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(Type param1, Type param2) {...});
paramName (paramType)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

Events

onCreated

chrome.bookmarks.onCreated.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onRemoved

chrome.bookmarks.onRemoved.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.

onFocusChanged

chrome.bookmarks.onFocusChanged.addListener(function(integer windowId) {...});

Undocumented.

A description from the json schema def of the event goes here.

Parameters

windowId (integer)
Undocumented.
Description of this parameter from the json schema.
paramName (optional paramType)
Undocumented.
Description of this parameter from the json schema.
-- cgit v1.1