blob: ae78bb29d6da42678e5a92eef909cb7f12694004 [file] [log] [blame]
// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "extensionTypes",
"description": "The <code>chrome.extensionTypes</code> API contains type declarations for Chrome extensions.",
"types": [
{
"id": "ImageFormat",
"type": "string",
"enum": ["jpeg", "png"],
"description": "The format of an image."
},
{
"id": "ImageDetails",
"type": "object",
"description": "Details about the format and quality of an image.",
"properties": {
"format": {
"$ref": "ImageFormat",
"optional": true,
"description": "The format of the resulting image. Default is <code>\"jpeg\"</code>."
},
"quality": {
"type": "integer",
"optional": true,
"minimum": 0,
"maximum": 100,
"description": "When format is <code>\"jpeg\"</code>, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease."
}
}
},
{
"id": "RunAt",
"type": "string",
"enum": [
{
"name":"document_start",
"description": "Script is injected after any files from css, but before any other DOM is constructed or any other script is run."
},
{
"name": "document_end",
"description": "Script is injected immediately after the DOM is complete, but before subresources like images and frames have loaded."
},
{
"name":"document_idle",
"description": "The browser chooses a time to inject the script between \"document_end\" and immediately after the <code>window.onload</code> event fires. The exact moment of injection depends on how complex the document is and how long it is taking to load, and is optimized for page load speed. Content scripts running at \"document_idle\" don't need to listen for the <code>window.onload</code> event; they are guaranteed to run after the DOM completes. If a script definitely needs to run after <code>window.onload</code>, the extension can check if <code>onload</code> has already fired by using the <code>document.readyState</code> property."
}
],
"description": "The soonest that the JavaScript or CSS will be injected into the tab."
},
{
"id": "CSSOrigin",
"type": "string",
"enum": ["author", "user"],
"description": "The <a href=\"https://www.w3.org/TR/css3-cascade/#cascading-origins\">origin</a> of injected CSS."
},
{
"id": "InjectDetails",
"type": "object",
"description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.",
"properties": {
"code": {"type": "string", "optional": true, "description": "JavaScript or CSS code to inject. <br><br><aside class='warning'><b>Warning:</b> Be careful using the <code>code</code> parameter. Incorrect use of it may open your extension to <a href='https://en.wikipedia.org/wiki/Cross-site_scripting'>cross site scripting</a> attacks</aside>"},
"file": {"type": "string", "optional": true, "description": "JavaScript or CSS file to inject."},
"allFrames": {
"type": "boolean",
"optional": true,
"description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame. If <code>true</code> and <code>frameId</code> is set, then the code is inserted in the selected frame and all of its child frames."
},
"frameId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "The <a href='webNavigation#frame_ids'>frame</a> where the script or CSS should be injected. Defaults to 0 (the top-level frame)."
},
"matchAboutBlank": {"type": "boolean", "optional": true, "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>."},
"runAt": {
"$ref": "RunAt",
"optional": true,
"description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"."
},
"cssOrigin": {
"$ref": "CSSOrigin",
"optional": true,
"description": "The <a href=\"https://www.w3.org/TR/css3-cascade/#cascading-origins\">origin</a> of the CSS to inject. This may only be specified for CSS, not JavaScript. Defaults to <code>\"author\"</code>."
}
}
},
{
"id": "DeleteInjectionDetails",
"type": "object",
"description": "Details of the CSS to remove. Either the code or the file property must be set, but both may not be set at the same time.",
"properties": {
"code": {"type": "string", "optional": true, "description": "CSS code to remove."},
"file": {"type": "string", "optional": true, "description": "CSS file to remove."},
"allFrames": {
"type": "boolean",
"optional": true,
"description": "If allFrames is <code>true</code>, implies that the CSS should be removed from all frames of current page. By default, it's <code>false</code> and is only removed from the top frame. If <code>true</code> and <code>frameId</code> is set, then the code is removed from the selected frame and all of its child frames."
},
"frameId": {
"type": "integer",
"optional": true,
"minimum": 0,
"description": "The <a href='webNavigation#frame_ids'>frame</a> from where the CSS should be removed. Defaults to 0 (the top-level frame)."
},
"matchAboutBlank": {"type": "boolean", "optional": true, "description": "If matchAboutBlank is true, then the code is also removed from about:blank and about:srcdoc frames if your extension has access to its parent document. By default it is <code>false</code>."},
"cssOrigin": {
"$ref": "CSSOrigin",
"optional": true,
"description": "The <a href=\"https://www.w3.org/TR/css3-cascade/#cascading-origins\">origin</a> of the CSS to remove. Defaults to <code>\"author\"</code>."
}
}
},
{
"id": "FrameType",
"type": "string",
"enum": ["outermost_frame", "fenced_frame", "sub_frame"],
"description": "The type of frame."
},
{
"id": "DocumentLifecycle",
"type": "string",
"enum": ["prerender", "active", "cached", "pending_deletion"],
"description": "The document lifecycle of the frame."
},
{
"id": "ExecutionWorld",
"type": "string",
"nodoc": true,
"enum": [
"ISOLATED",
"MAIN",
"USER_SCRIPT"
],
"description": "The JavaScript world for a script to execute within. Can either be an isolated world unique to this extension, the main world of the DOM which is shared with the page's JavaScript, or a user scripts world that is only available for scripts registered with the User Scripts API."
}
]
}
]