chrome.experimental.contextMenu
API reference: chrome.experimental.contextMenu
Properties
getLastError
chrome.extensionlastError
Methods
create
void
chrome.experimental.contextMenu.create(, object
createProperties, function
callback)
Undocumented.
An API to add items to context menus.
Parameters
-
createProperties
(
optional
Type
array of
object
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
type
(
optional
Type
array of
string
)
-
Undocumented.
- The type of menu item - one of 'NORMAL', 'CHECKBOX', 'RADIO', or 'SEPARATOR'. Defaults to 'NORMAL' if not specified.
-
-
title
(
optional
Type
array of
string
)
-
Undocumented.
- This must be specified unless type is 'SEPARATOR'.
-
-
checked
(
optional
Type
array of
boolean
)
-
Undocumented.
- For items of type CHECKBOX or RADIO, should this be selected (RADIO) or checked (CHECKBOX)? Only one RADIO item can be selected at a time in a given group of RADIO items, with the last one to have checked == true winning.
-
-
contexts
(
optional
Type
array of
Type
array of
string
paramType
)
-
Undocumented.
- List of contexts this menu item will appear in. Legal values are: 'ALL', 'PAGE', 'SELECTION', 'LINK', 'EDITABLE', 'IMAGE', 'VIDEO', and 'AUDIO'. Defaults to ['PAGE'].
-
-
enabledContexts
(
optional
Type
array of
Type
array of
string
paramType
)
-
Undocumented.
- By default the values you pass for the contexts parameter make an item both shown and selectable in those contexts. If you want to limit the contexts where an item is selectable (i.e. not greyed out), you put the ones you want selectable in enabledContexts and any not listed will be shown but disabled. So, for example, if you wanted an item to appear for links and images but only be enabled for links, you would set 'contexts' : ['LINK', 'IMAGE'] and 'enabledContexts' : ['LINK'].
-
-
onclick
(
optional
Type
array of
function
)
-
Undocumented.
- Function to be called back when your menu item or one of its children is clicked.
-
-
parentId
(
optional
Type
array of
integer
)
-
Undocumented.
- The id of a parent menu item - this makes the item a child of a previously added item.
-
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(integer menuItemId) {...});
-
menuItemId
(
optional
Type
array of
integer
)
-
Undocumented.
- The id of the newly created context menu item.
-
remove
void
chrome.experimental.contextMenu.remove(, integer
menuItemId, function
callback)
Undocumented.
Remove a context menu item.
Parameters
-
menuItemId
(
optional
Type
array of
integer
)
-
Undocumented.
- The id of the context menu item to remove.
-
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
- Called when the context menu has been removed.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function() {...});
removeAll
void
chrome.experimental.contextMenu.removeAll(, function
callback)
Undocumented.
Remove all context menu items added by this extension.
Parameters
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
- Called when removal is complete.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function() {...});
update
void
chrome.experimental.contextMenu.update(, integer
id, object
updateProperties, function
callback)
Undocumented.
Update a previously created context menu item.
Parameters
-
id
(
optional
Type
array of
integer
)
-
Undocumented.
- The id of the item to update.
-
-
updateProperties
(
optional
Type
array of
object
)
-
Undocumented.
- The properties to update. Accepts the same values as the create function.
-
-
type
(
optional
Type
array of
string
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
title
(
optional
Type
array of
string
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
checked
(
optional
Type
array of
boolean
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
contexts
(
optional
Type
array of
Type
array of
string
paramType
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
enabledContexts
(
optional
Type
array of
Type
array of
string
paramType
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
onclick
(
optional
Type
array of
function
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
-
parentId
(
optional
Type
array of
integer
)
-
Undocumented.
- Note: you cannot change an item to be a child of one of it's own descendants.
-
-
callback
(
optional
Type
array of
function
)
-
Undocumented.
- Called when the context menu has been updated.
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function() {...});
Events
event name
chrome.bookmarksonEvent.addListener(function(Type param1, Type param2) {...});
Undocumented.
A description from the json schema def of the event goes here.
Parameters