mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-10 17:49:58 +00:00
Unify receiver selector launching and allow switching to app media type
This commit is contained in:
@@ -65,12 +65,7 @@ function initBrowserAction () {
|
||||
* top-level frame.
|
||||
*/
|
||||
browser.browserAction.onClicked.addListener(async tab => {
|
||||
const currentShim = ShimManager.getShim(tab.id);
|
||||
const selection = await ReceiverSelectorManager.getSelection(
|
||||
ReceiverSelectorMediaType.Tab
|
||||
, getMediaTypesForPageUrl(tab.url)
|
||||
& ~ReceiverSelectorMediaType.App
|
||||
, currentShim.requestedAppId);
|
||||
const selection = await ReceiverSelectorManager.getSelection(tab.id);
|
||||
|
||||
if (selection) {
|
||||
loadSender({
|
||||
@@ -161,11 +156,8 @@ async function initMenus () {
|
||||
|
||||
switch (info.menuItemId) {
|
||||
case menuIdMediaCast: {
|
||||
const currentShim = ShimManager.getShim(tab.id, info.frameId);
|
||||
const selection = await ReceiverSelectorManager.getSelection(
|
||||
ReceiverSelectorMediaType.App
|
||||
, availableMediaTypes
|
||||
, currentShim.requestedAppId);
|
||||
tab.id, info.frameId);
|
||||
|
||||
// Selection cancelled
|
||||
if (!selection) {
|
||||
@@ -204,11 +196,8 @@ async function initMenus () {
|
||||
}
|
||||
|
||||
case menuIdMirroringCast: {
|
||||
const currentShim = ShimManager.getShim(tab.id, info.frameId);
|
||||
const selection = await ReceiverSelectorManager.getSelection(
|
||||
ReceiverSelectorMediaType.Tab
|
||||
, availableMediaTypes & ~ReceiverSelectorMediaType.App
|
||||
, currentShim.requestedAppId);
|
||||
tab.id, info.frameId);
|
||||
|
||||
loadSender({
|
||||
tabId: tab.id
|
||||
|
||||
Reference in New Issue
Block a user