Adding in content notification to look more browser like.

This commit is contained in:
Jonathan Kingston
2017-06-01 03:28:02 +01:00
parent 49e8afaf9a
commit 06d35e65ce
4 changed files with 93 additions and 10 deletions
+5 -8
View File
@@ -159,7 +159,7 @@ const assignManager = {
//storageAction = this.storageArea.remove(info.pageUrl);
remove = true;
}
await this._setOrRemoveAssignment(info.pageUrl, userContextId, remove);
await this._setOrRemoveAssignment(tab.id, info.pageUrl, userContextId, remove);
this.calculateContextMenu(tab);
}
},
@@ -192,7 +192,7 @@ const assignManager = {
return true;
},
async _setOrRemoveAssignment(pageUrl, userContextId, remove) {
async _setOrRemoveAssignment(tabId, pageUrl, userContextId, remove) {
let actionName;
if (!remove) {
await this.storageArea.set(pageUrl, {
@@ -205,11 +205,8 @@ const assignManager = {
await this.storageArea.remove(pageUrl);
actionName = "removed";
}
browser.notifications.create({
type: "basic",
title: "Containers",
message: `Successfully ${actionName} site to always open in this container`,
iconUrl: browser.extension.getURL("/img/onboarding-1.png")
browser.tabs.sendMessage(tabId, {
text: `Successfully ${actionName} site to always open in this container`
});
backgroundLogic.sendTelemetryPayload({
event: `${actionName}-container-assignment`,
@@ -432,7 +429,7 @@ const messageHandler = {
case "setOrRemoveAssignment":
response = browser.tabs.get(m.tabId).then((tab) => {
const userContextId = assignManager.getUserContextIdFromCookieStore(tab);
return assignManager._setOrRemoveAssignment(tab.url, userContextId, m.value);
return assignManager._setOrRemoveAssignment(tab.id, tab.url, userContextId, m.value);
});
break;
case "exemptContainerAssignment":