Bug 1661475 - Add a "Manage devices" item to the Send Tab menu. r=markh

Differential Revision: https://phabricator.services.mozilla.com/D88420
This commit is contained in:
Edouard Oger 2020-08-27 21:50:46 +00:00
Родитель c084c684de
Коммит 6fe4fd09b5
4 изменённых файлов: 42 добавлений и 1 удалений

Просмотреть файл

@ -1041,8 +1041,8 @@ var gSync = {
addTargetDevice(target.id, target.name, type, lastModified);
}
// "Send to All Devices" menu item
if (targets.length > 1) {
// "Send to All Devices" menu item
const separator = createDeviceNodeFn();
separator.classList.add("sync-menuitem");
fragment.appendChild(separator);
@ -1050,6 +1050,27 @@ var gSync = {
"sendToAllDevices.menuitem"
);
addTargetDevice("", allDevicesLabel, "");
// "Manage devices" menu item
const manageDevicesLabel = this.fxaStrings.GetStringFromName(
"manageDevices.menuitem"
);
// We piggyback on the createDeviceNodeFn implementation,
// it's a big disgusting.
const targetDevice = createDeviceNodeFn(
null,
manageDevicesLabel,
null,
null
);
targetDevice.addEventListener(
"command",
() => gSync.openDevicesManagementPage("sendtab"),
true
);
targetDevice.classList.add("sync-menuitem", "sendtab-target");
targetDevice.setAttribute("label", manageDevicesLabel);
fragment.appendChild(targetDevice);
}
},

Просмотреть файл

@ -508,6 +508,11 @@ add_task(async function sendToDevice_syncNotReady_configured() {
label: "Send to All Devices",
},
});
expectedItems.push(null, {
attrs: {
label: "Manage Devices...",
},
});
checkSendToDeviceItems(expectedItems);
} else {
ok(false, "This should never happen");
@ -739,6 +744,11 @@ add_task(async function sendToDevice_devices() {
label: "Send to All Devices",
},
},
{
attrs: {
label: "Manage Devices...",
},
},
];
checkSendToDeviceItems(expectedItems);
@ -1014,6 +1024,11 @@ add_task(async function sendToDevice_inUrlbar() {
label: "Send to All Devices",
},
},
{
attrs: {
label: "Manage Devices...",
},
},
];
checkSendToDeviceItems(expectedItems, true);

Просмотреть файл

@ -47,6 +47,7 @@ add_task(async function test_page_contextmenu() {
{ label: "Foo" },
"----",
{ label: "Send to All Devices" },
{ label: "Manage Devices..." },
]);
await hideContentContextMenu();

Просмотреть файл

@ -41,6 +41,10 @@ thisDeviceDisconnectedBody = This computer has been disconnected.
# Displayed in the Send Tab/Page/Link to Device context menu when right clicking a tab, a page or a link.
sendToAllDevices.menuitem = Send to All Devices
# LOCALIZATION NOTE (manageDevices.menuitem)
# Displayed in the Send Tab/Page/Link to Device context menu when right clicking a tab, a page or a link.
manageDevices.menuitem = Manage Devices…
# LOCALIZATION NOTE (sendTabToDevice.unconfigured, sendTabToDevice.unconfigured.label2)
# Displayed in the Send Tabs context menu when right clicking a tab, a page or a link
# and the Sync account is unconfigured. Redirects to a marketing page.