Bug 1706164 - Share screen and window sharing status from webrtcUI via sharedData. r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D115416
This commit is contained in:
Bryce Seager van Dyk 2021-05-21 19:59:53 +00:00
Родитель 243f6d23d0
Коммит 5e5e77b651
1 изменённых файлов: 29 добавлений и 0 удалений

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

@ -466,6 +466,7 @@ var webrtcUI = {
this.tabSwitchCountForSession = 0;
}
this._setSharedData();
if (
Services.prefs.getBoolPref(
"privacy.webrtc.allowSilencingNotifications",
@ -507,6 +508,7 @@ var webrtcUI = {
}
this.updateGlobalIndicator();
this._setSharedData();
},
/**
@ -902,6 +904,33 @@ var webrtcUI = {
args
);
},
/**
* Updates the sharedData structure to reflect shared screen and window
* state. This sets the following key: data pairs on sharedData.
* - "webrtcUI:isSharingScreen": a boolean value reflecting
* this.sharingScreen.
* - "webrtcUI:sharedTopInnerWindowIds": a set containing the inner window
* ids of each top level browser window that is in sharedBrowserWindows.
*/
_setSharedData() {
let sharedTopInnerWindowIds = new Set();
for (let win of BrowserWindowTracker.orderedWindows) {
if (this.sharedBrowserWindows.has(win)) {
sharedTopInnerWindowIds.add(
win.browsingContext.currentWindowGlobal.innerWindowId
);
}
}
Services.ppmm.sharedData.set(
"webrtcUI:isSharingScreen",
this.sharingScreen
);
Services.ppmm.sharedData.set(
"webrtcUI:sharedTopInnerWindowIds",
sharedTopInnerWindowIds
);
},
};
function getGlobalIndicator() {