1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-27 10:23:48 +01:00

define top-level (root) context menu item.

This commit is contained in:
Kyle Spearrin 2016-11-24 23:54:22 -05:00
parent 8c4abf81de
commit f83d8b6484

View File

@ -90,31 +90,42 @@ if (chrome.runtime.onInstalled) {
function buildContextMenu(callback) { function buildContextMenu(callback) {
chrome.contextMenus.removeAll(function () { chrome.contextMenus.removeAll(function () {
chrome.contextMenus.create({
type: 'normal',
id: 'root',
contexts: ['all'],
title: 'bitwarden'
}, function () {
chrome.contextMenus.create({ chrome.contextMenus.create({
type: 'normal', type: 'normal',
id: 'autofill', id: 'autofill',
parentId: 'root',
contexts: ['all'], contexts: ['all'],
title: i18nService.autoFill title: i18nService.autoFill
}, function () { }, function () {
chrome.contextMenus.create({ chrome.contextMenus.create({
type: 'normal', type: 'normal',
id: 'copy-username', id: 'copy-username',
parentId: 'root',
contexts: ['all'], contexts: ['all'],
title: i18nService.copyUsername title: i18nService.copyUsername
}, function () { }, function () {
chrome.contextMenus.create({ chrome.contextMenus.create({
type: 'normal', type: 'normal',
id: 'copy-password', id: 'copy-password',
parentId: 'root',
contexts: ['all'], contexts: ['all'],
title: i18nService.copyPassword title: i18nService.copyPassword
}, function () { }, function () {
chrome.contextMenus.create({ chrome.contextMenus.create({
type: 'separator' type: 'separator',
parentId: 'root'
}); });
chrome.contextMenus.create({ chrome.contextMenus.create({
type: 'normal', type: 'normal',
id: 'generate-password', id: 'generate-password',
parentId: 'root',
contexts: ['all'], contexts: ['all'],
title: i18nService.generatePasswordCopied title: i18nService.generatePasswordCopied
}, function () { }, function () {
@ -126,6 +137,7 @@ function buildContextMenu(callback) {
}); });
}); });
}); });
});
} }
chrome.tabs.onActivated.addListener(function (activeInfo) { chrome.tabs.onActivated.addListener(function (activeInfo) {