Google Chrome Extensions

chrome.management

The chrome.management module provides ways to manage the list of extensions/apps that are installed and running. It is particularly useful for extensions that override the built-in New Tab page.

Manifest

You must declare the "management" permission in the extension manifest to use the management API. For example:

{
  "name": "My extension",
  ...
  "permissions": [
    "management"
  ],
  ...
}

The one method that doesn't require the "management" permission is getPermissionWarningsByManifest

API Reference: chrome.management

Types

IconInfo

( object )
Information about an icon belonging to an extension, app, or theme.

Properties of IconInfo

size ( integer )
A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16.
url ( string )
The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append ?grayscale=true to the URL.

ExtensionInfo

( object )
Information about an installed extension, app, or theme.

Properties of ExtensionInfo

id ( string )
The extension's unique identifier.
name ( string )
The name of this extension, app, or theme.
description ( string )
The description of this extension, app, or theme.
version ( string )
The version of this extension, app, or theme.
mayDisable ( boolean )
Whether this extension can be disabled or uninstalled by the user.
enabled ( boolean )
Whether it is currently enabled or disabled.
disabledReason ( optional enumerated string ["unknown", "permissions_increase"] )
A reason the item is disabled.
type ( enumerated string ["extension", "hosted_app", "packaged_app", "legacy_packaged_app", "theme"] )
The type of this extension, app, or theme.
appLaunchUrl ( optional string )
The launch url (only present for apps).
homepageUrl ( optional string )
The URL of the homepage of this extension, app, or theme.
updateUrl ( optional string )
The update URL of this extension, app, or theme.
offlineEnabled ( boolean )
Whether the extension, app, or theme declares that it supports offline.
optionsUrl ( string )
The url for the item's options page, if it has one.
icons ( optional array of IconInfo )
A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the manifest documentation on icons for more details.
permissions ( array of string )
Returns a list of API based permissions.
hostPermissions ( array of string )
Returns a list of host based permissions.
installType ( enumerated string ["admin", "development", "normal", "sideload", "other"] )
How the extension was installed. One of
admin: The extension was installed because of an administrative policy,
development: The extension was loaded unpacked in developer mode,
normal: The extension was installed normally via a .crx file,
sideload: The extension was installed by other software on the machine,
other: The extension was installed by other means.

Methods

getAll

chrome.management.getAll()

Returns a list of information about installed extensions and apps.

get

chrome.management.get(string id)

Returns information about the installed extension, app, or theme that has the given ID.

Parameters

id ( string )
The ID from an item of ExtensionInfo.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(ExtensionInfo result) {...};
result ( ExtensionInfo )

getPermissionWarningsById

chrome.management.getPermissionWarningsById(string id)

Returns a list of permission warnings for the given extension id.

Parameters

id ( string )
The ID of an already installed extension.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(array of string permissionWarnings) {...};
permissionWarnings ( array of string )

getPermissionWarningsByManifest

chrome.management.getPermissionWarningsByManifest(string manifestStr)

Returns a list of permission warnings for the given extension manifest string. Note: This function can be used without requesting the 'management' permission in the manifest.

Parameters

manifestStr ( string )
Extension manifest JSON string.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function(array of string permissionWarnings) {...};
permissionWarnings ( array of string )

setEnabled

chrome.management.setEnabled(string id, boolean enabled)

Enables or disables an app or extension.

Parameters

id ( string )
This should be the id from an item of ExtensionInfo.
enabled ( boolean )
Whether this item should be enabled or disabled.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...};

uninstall

chrome.management.uninstall(string id, object options)

Uninstalls a currently installed app or extension.

Parameters

id ( string )
This should be the id from an item of ExtensionInfo.
options ( optional object )
showConfirmDialog ( optional boolean )
Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...};

launchApp

chrome.management.launchApp(string id)

Launches an application.

Parameters

id ( string )
The extension id of the application.

Callback function

If you specify the callback parameter, it should specify a function that looks like this:

function() {...};

Events

onInstalled

chrome.management.onInstalled.addListener(function(ExtensionInfo info) {...});

Fired when an app or extension has been installed.

Listener Parameters

info ( ExtensionInfo )

onUninstalled

chrome.management.onUninstalled.addListener(function(string id) {...});

Fired when an app or extension has been uninstalled.

Listener Parameters

id ( string )
The id of the extension, app, or theme that was uninstalled.

onEnabled

chrome.management.onEnabled.addListener(function(ExtensionInfo info) {...});

Fired when an app or extension has been enabled.

Listener Parameters

info ( ExtensionInfo )

onDisabled

chrome.management.onDisabled.addListener(function(ExtensionInfo info) {...});

Fired when an app or extension has been disabled

Listener Parameters

info ( ExtensionInfo )

Sample Extensions that use chrome.management

  • App Launcher