| // Copyright 2017 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| [ |
| { |
| "namespace": "action", |
| "description": "Use actions to put icons in the main Google Chrome toolbar, to the right of the address bar. Actions can be set to take action on all pages (default_state: enabled) or only the current page (default_state: disabled). If an action is default disabled, the action appears grayed out when inactive. In addition to its <a href='action#icon'>icon</a>, an action can also have a <a href='action#tooltip'>tooltip</a>, a <a href='action#badge'>badge</a>, and a <a href='action#popups'>popup</a>.", |
| "compiler_options": { |
| "implemented_in": "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| }, |
| "functions": [{ |
| "name": "setTitle", |
| "type": "function", |
| "description": "Sets the title of the action. This shows up in the tooltip.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "title": { |
| "type": "string", |
| "description": "The string the action should display when moused over." |
| }, |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| }] |
| }, { |
| "name": "getTitle", |
| "type": "function", |
| "description": "Gets the title of the action.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Specify the tab to get the title from. If no tab is specified, the non-tab-specific title is returned." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [{ |
| "name": "result", |
| "type": "string" |
| }] |
| }] |
| }, { |
| "name": "setIcon", |
| "type": "function", |
| "description": "Sets the icon for the action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <b>path</b> or the <b>imageData</b> property must be specified.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "imageData": { |
| "choices": [{ |
| "$ref": "browserAction.ImageDataType" |
| }, { |
| "type": "object", |
| "additionalProperties": { "type": "any" } |
| }], |
| "optional": true, |
| "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'16': foo}'" |
| }, |
| "path": { |
| "choices": [{ |
| "type": "string" |
| }, { |
| "type": "object", |
| "additionalProperties": { "type": "any" } |
| }], |
| "optional": true, |
| "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * n will be selected, where n is the size of the icon in the UI. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.path = {'16': foo}'" |
| }, |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "optional": true, |
| "parameters": [] |
| }] |
| }, { |
| "name": "setPopup", |
| "type": "function", |
| "description": "Sets the html document to be opened as a popup when the user clicks on the action's icon.", |
| "parameters": [ |
| { |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." |
| }, |
| "popup": { |
| "type": "string", |
| "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| } |
| ] |
| }, { |
| "name": "getPopup", |
| "type": "function", |
| "description": "Gets the html document set as the popup for this action.", |
| "parameters": [ |
| { |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Specify the tab to get the popup from. If no tab is specified, the non-tab-specific popup is returned." |
| } |
| } |
| }, |
| { |
| "type": "function", |
| "name": "callback", |
| "parameters": [ |
| { |
| "name": "result", |
| "type": "string" |
| } |
| ] |
| } |
| ] |
| }, { |
| "name": "setBadgeText", |
| "type": "function", |
| "description": "Sets the badge text for the action. The badge is displayed on top of the icon.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "text": { |
| "type": "string", |
| "description": "Any number of characters can be passed, but only about four can fit in the space." |
| }, |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| }] |
| }, { |
| "name": "getBadgeText", |
| "type": "function", |
| "description": "Gets the badge text of the action. If no tab is specified, the non-tab-specific badge text is returned.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Specify the tab to get the badge text from. If no tab is specified, the non-tab-specific badge text is returned." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [{ |
| "name": "result", |
| "type": "string" |
| }] |
| }] |
| }, { |
| "name": "setBadgeBackgroundColor", |
| "type": "function", |
| "description": "Sets the background color for the badge.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "color": { |
| "description": "An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>#FF0000</code> or <code>#F00</code>.", |
| "choices": [ |
| {"type": "string"}, |
| {"$ref": "browserAction.ColorArray"} |
| ] |
| }, |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Limits the change to when a particular tab is selected. Automatically resets when the tab is closed." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| }] |
| }, { |
| "name": "getBadgeBackgroundColor", |
| "type": "function", |
| "description": "Gets the background color of the action.", |
| "parameters": [{ |
| "name": "details", |
| "type": "object", |
| "properties": { |
| "tabId": { |
| "type": "integer", |
| "optional": true, |
| "minimum": 0, |
| "description": "Specify the tab to get the badge background color from. If no tab is specified, the non-tab-specific badge background color is returned." |
| } |
| } |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [{ |
| "name": "result", |
| "$ref": "browserAction.ColorArray" |
| }] |
| }] |
| }, { |
| "name": "enable", |
| "type": "function", |
| "description": "Enables the action for a tab. By default, actions are enabled.", |
| "parameters": [{ |
| "type": "integer", |
| "optional": true, |
| "name": "tabId", |
| "minimum": 0, |
| "description": "The id of the tab for which you want to modify the action." |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| }] |
| }, { |
| "name": "disable", |
| "type": "function", |
| "description": "Disables the action for a tab.", |
| "parameters": [{ |
| "type": "integer", |
| "optional": true, |
| "name": "tabId", |
| "minimum": 0, |
| "description": "The id of the tab for which you want to modify the action." |
| }, { |
| "type": "function", |
| "name": "callback", |
| "parameters": [], |
| "optional": true |
| }] |
| }], |
| "events": [{ |
| "name": "onClicked", |
| "type": "function", |
| "description": "Fired when an action icon is clicked. This event will not fire if the action has a popup.", |
| "parameters": [{ |
| "name": "tab", |
| "$ref": "tabs.Tab" |
| }] |
| }] |
| } |
| ] |