Add missing callbacks to browserAction/pageAction (#35236)

The callback parameter is supported since Chrome 67 on the methods listed below,
thanks to https://crrev.com/c/979451

* pageAction.show
* pageAction.hide
* pageAction.setTitle
* pageAction.setPopup

* browserAction.enable
* browserAction.disable
* browserAction.setBadgeBackgroundColor
* browserAction.setBadgeText
* browserAction.setTitle
* browserAction.setPopup
This commit is contained in:
tophf 2019-05-14 20:58:03 +03:00 committed by Nathan Shively-Sanders
parent b0efb56e7a
commit 00a507fc0d

View File

@ -488,29 +488,42 @@ declare namespace chrome.browserAction {
* Since Chrome 22.
* Enables the browser action for a tab. By default, browser actions are enabled.
* @param tabId The id of the tab for which you want to modify the browser action.
* @param callback Supported since Chrome 67
*/
export function enable(tabId?: number): void;
/** Sets the background color for the badge. */
export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails): void;
/** Sets the badge text for the browser action. The badge is displayed on top of the icon. */
export function setBadgeText(details: BadgeTextDetails): void;
/** Sets the title of the browser action. This shows up in the tooltip. */
export function setTitle(details: TitleDetails): void;
export function enable(tabId?: number, callback?: () => void): void;
/**
* Sets the background color for the badge.
* @param callback Supported since Chrome 67
*/
export function setBadgeBackgroundColor(details: BadgeBackgroundColorDetails, callback?: () => void): void;
/**
* Sets the badge text for the browser action. The badge is displayed on top of the icon.
* @param callback Supported since Chrome 67
*/
export function setBadgeText(details: BadgeTextDetails, callback?: () => void): void;
/**
* Sets the title of the browser action. This shows up in the tooltip.
* @param callback Supported since Chrome 67
*/
export function setTitle(details: TitleDetails, callback?: () => void): void;
/**
* Since Chrome 19.
* Gets the badge text of the browser action. If no tab is specified, the non-tab-specific badge text is returned.
* @param callback The callback parameter should be a function that looks like this:
* function(string result) {...};
* @param callback Supported since Chrome 67
*/
export function getBadgeText(details: TabDetails, callback: (result: string) => void): void;
/** Sets the html document to be opened as a popup when the user clicks on the browser action's icon. */
export function setPopup(details: PopupDetails): void;
/**
* Sets the html document to be opened as a popup when the user clicks on the browser action's icon.
* @param callback Supported since Chrome 67
*/
export function setPopup(details: PopupDetails, callback?: () => void): void;
/**
* Since Chrome 22.
* Disables the browser action for a tab.
* @param tabId The id of the tab for which you want to modify the browser action.
* @param callback Supported since Chrome 67
*/
export function disable(tabId?: number): void;
export function disable(tabId?: number, callback?: () => void): void;
/**
* Since Chrome 19.
* Gets the title of the browser action.
@ -4703,17 +4716,25 @@ declare namespace chrome.pageAction {
/**
* Shows the page action. The page action is shown whenever the tab is selected.
* @param tabId The id of the tab for which you want to modify the page action.
* @param callback Supported since Chrome 67
*/
export function hide(tabId: number, callback?: () => void): void;
/**
* Shows the page action. The page action is shown whenever the tab is selected.
* @param tabId The id of the tab for which you want to modify the page action.
* @param callback Supported since Chrome 67
*/
export function show(tabId: number, callback?: () => void): void;
/** Sets the title of the page action. This is displayed in a tooltip over the page action. */
export function setTitle(details: TitleDetails): void;
/** Sets the html document to be opened as a popup when the user clicks on the page action's icon. */
export function setPopup(details: PopupDetails): void;
/**
* Sets the title of the page action. This is displayed in a tooltip over the page action.
* @param callback Supported since Chrome 67
*/
export function setTitle(details: TitleDetails, callback?: () => void): void;
/**
* Sets the html document to be opened as a popup when the user clicks on the page action's icon.
* @param callback Supported since Chrome 67
*/
export function setPopup(details: PopupDetails, callback?: () => void): void;
/**
* Gets the title of the page action.
* @since Chrome 19.