vivaldi.extensionActionUtils Modders API Reference
Helper functions for Vivaldi to reuse Chromes extension UI.
Types
#ActionType
ENUM
browser- or pageAction.
- browser
- page
#ExtensionType
ENUM
Regular extension- or componentAction. Component actions will go through ToolbarActionViewController
- extensionAction
- componentAction
#MenuType
ENUM
What type of menu item.
- normal
- checkbox
- radio
- separator
#GlobalErrorType
ENUM
Type of global error. Disabled because of permission increase, or installed by third-party.
- installed
- upgrade
#MenuItem
Menu item representing a single menu item.
Properties:
- name
string
The name of the item as shown in the menu.
- id
string
The id for the item.
- enabled
boolean
Is the item enabled.
- visible
boolean
Is the item visible.
- checked
boolean
Is the item checked.
- menuType
MenuType
⚠ NO DESCRIPTION PROVIDED
- submenu
- (optional)
Sub menu items if the extension supplies a custom menu.
Array
of:- MenuItem
#SidePanelInfo
Side Panel description (if exists).
Properties:
- url
string
Side Panel URL.
- activeUrl
string
Side Panel URL.
#SidePanelOptions
⚠ NO DESCRIPTION PROVIDED
Properties:
- tabId
- (optional)
integer
If specified, the side panel options will only apply to the tab with this id. If omitted, these options set the default behavior (used for any tab that doesn't have specific settings). Note: if the same path is set for this tabId and the default tabId, then the panel for this tabId will be a different instance than the panel for the default tabId.
- path
- (optional)
string
The path to the side panel HTML file to use. This must be a local resource within the extension package.
- extensionId
- (optional)
string
The path to the side panel HTML file to use. This must be a local resource within the extension package.
- resourceUrl
- (optional)
string
The path to the side panel HTML file to use. This must be a local resource within the extension package.
- enabled
- (optional)
boolean
Whether the side panel should be enabled. This is optional. The default value is true.
#ExtensionInfo
Extension action per tab id.
Properties:
- tabId
integer
tab id, or kDefaultTabId(-1) if the information should be used for all tabs.
- id
string
The unique extension identifier.
- badgeTooltip
- (optional)
string
Tooltip for the button.
- badgeText
- (optional)
string
Badgetext, typically room for four chars.
- badgeIcon
- (optional)
string
data-url for the current icon.
- badgeTextColor
- (optional)
string
Text color for the badge text, currently unused.
- badgeBackgroundColor
- (optional)
string
Background color for the badge text.
- enabled
- (optional)
boolean
Whether the extension is enabled or not.
- actionType
- (optional)
ActionType
The type of the extensionAction, either pageaction or browseraction.
- visible
- (optional)
boolean
Visibility of the action button, defaults to true.
- allowInIncognito
- (optional)
boolean
Whether the action is available in incognito windows or not.
- extensionType
- (optional)
ExtensionType
The type of the extensionAction, either pageaction or browseraction. Defaults to |extensionAction|.
- name
string
Name of extension.
- homepage
- (optional)
string
Homepage of extension.
- optionspage
- (optional)
string
Address of extension options page.
- optionsInNewTab
- (optional)
boolean
false if the options page should be opened embedded, true if it opens in a new tab.
- keyboardShortcut
- (optional)
string
Keyboard shortcut to toggle this extension.
- sidePanel
- (optional)
SidePanelInfo
contains sidepanel URL.
#ExtensionInstallError
Extension error.
Properties:
- id
string
The unique extension identifier.
- name
string
Extension name.
- errorType
- (optional)
GlobalErrorType
The type of the extensionAction, either pageaction or browseraction. Defaults to |extensionAction|.
- commandId
integer
Int id to lookup an error on action.
Listeners
How to use listeners
Each listener type has the same functions, used for each listener API in the same way:
.addListener(function
callback)
Adds a function to a listener for an event
.removeListener(function
callback)
Removes a function to a listener for an event
.hasListener(function
callback)
Returns a boolean if a function is attached to a listener for an event
.hasListeners()
Returns a boolean if a listener has any attached functions
.dispatch()
Returns array of promises dispatched to the listener
#onAdded
Fired when an extension has been loaded.
Parameters:
- extension
ExtensionInfo
⚠ NO DESCRIPTION PROVIDED
#onRemoved
Fired when an extension has been unloaded.
Parameters:
- extension
ExtensionInfo
⚠ NO DESCRIPTION PROVIDED
#onUpdated
Fired when an extensionAction is changed.
Parameters:
- extension
ExtensionInfo
⚠ NO DESCRIPTION PROVIDED
#onClearAllValuesForTab
Fired on ExtensionAction::ClearAllValuesForTab().
Parameters:
- extensionId
string
⚠ NO DESCRIPTION PROVIDED
- tabId
number
⚠ NO DESCRIPTION PROVIDED
#onCommandAdded
Fired when a keyboard shortcut is added to an extension.
Parameters:
- extensionId
string
⚠ NO DESCRIPTION PROVIDED
- shortcut
string
⚠ NO DESCRIPTION PROVIDED
#onCommandRemoved
Fired when a keyboard shortcut is removed from an extension.
Parameters:
- extensionId
string
⚠ NO DESCRIPTION PROVIDED
- shortcut
string
⚠ NO DESCRIPTION PROVIDED
#onExtensionDisabledInstallErrorAdded
Fired when an extensionerror is created. Can be of various kinds of GlobalErrors
Parameters:
- error
ExtensionInstallError
⚠ NO DESCRIPTION PROVIDED
#onExtensionDisabledInstallErrorRemoved
Fired when an extensionerror is handled or removed. Can be of various kinds of GlobalErrors.
Parameters:
- error
ExtensionInstallError
⚠ NO DESCRIPTION PROVIDED
#onSidePanelOptionChanged
Fired when side panel opetion changed
Parameters:
- extendionId
string
The unique extension identifier.
- options
SidePanelOptions
⚠ NO DESCRIPTION PROVIDED
#onSidePanelActionRequested
Fired when side panel action requested
Parameters:
- extendionId
string
The unique extension identifier.
- Action
string
The unique action identifier.
Methods
#getToolbarExtensions
#executeExtensionAction
execute browserAction or pageAction for extension
Parameters:
- extensionId
string
- windowId
integer
id of the application window.
#removeExtension
Removes a specified extension.
Parameters:
- extensionId
string
The id for the extension we want to remove.
- windowId
integer
id of the application window. Used to find the Browser object.
#showExtensionOptions
Shows options for the given extension
Parameters:
- extensionId
string
The id for the extension we want to remove.
- windowId
integer
id of the application window. Used to find the Browser object.
#getExtensionMenu
Gets the context menu for the given extension
Parameters:
- extensionId
string
The id for the extension we want to get the menu for.
#executeMenuAction
Execute menu action for extension.
Parameters:
- extensionId
string
- windowId
integer
id of the application window.
- menuId
string
id of the menu item.
#showGlobalError
Show the dialog for an extension install error.
Parameters:
- commandId
integer
The id for the error.
- windowId
integer
id of the application window. Used to find the Browser object.
#triggerGlobalErrors
Loop through any pending global extension errors and fire events for the ui.