mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
Add option to disable content menu integation (#99)
* Add option to disable content menu integation Fixes issue #98 * pass tab to contextMenuReady
This commit is contained in:
committed by
Kyle Spearrin
parent
0298c19e13
commit
84821fd67d
@@ -78,6 +78,8 @@ chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {
|
||||
pageDetailsToAutoFill.push({ frameId: sender.frameId, tabId: msg.tabId, details: msg.details });
|
||||
autofillTimeout = setTimeout(autofillPage, 300);
|
||||
}
|
||||
} else if (msg.command === 'bgUpdateContextMenu') {
|
||||
refreshBadgeAndMenu();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -227,13 +229,23 @@ function refreshBadgeAndMenu() {
|
||||
return;
|
||||
}
|
||||
|
||||
buildContextMenu(function () {
|
||||
loadMenuAndUpdateBadge(tab.url, tab.id, true);
|
||||
onUpdatedRan = onReplacedRan = false;
|
||||
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
|
||||
if (! obj[constantsService.disableContextMenuItemKey]) {
|
||||
buildContextMenu(function() { contextMenuReady(tab) });
|
||||
}
|
||||
else {
|
||||
chrome.contextMenus.removeAll();
|
||||
contextMenuReady(tab);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function contextMenuReady(tab) {
|
||||
loadMenuAndUpdateBadge(tab.url, tab.id, true);
|
||||
onUpdatedRan = onReplacedRan = false;
|
||||
}
|
||||
|
||||
function loadMenuAndUpdateBadge(url, tabId, loadContextMenuOptions) {
|
||||
if (!url) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user