mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
2144399143
--HG-- extra : rebase_source : 1b441c55e6e78b6096977dc25dd232c3c6bb653c
37 lines
1.6 KiB
JavaScript
37 lines
1.6 KiB
JavaScript
# -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
function gEMEListener(msg /*{target: browser, data: data} */) {
|
|
let browser = msg.target;
|
|
let notificationId = "drmContentPlaying";
|
|
// Don't need to show if disabled, nor reshow if it's already there
|
|
if (!Services.prefs.getBoolPref("browser.eme.ui.enabled") ||
|
|
PopupNotifications.getNotification(notificationId, browser)) {
|
|
return;
|
|
}
|
|
|
|
let msgId = "emeNotifications.drmContentPlaying.message";
|
|
let brandName = document.getElementById("bundle_brand").getString("brandShortName");
|
|
let message = gNavigatorBundle.getFormattedString(msgId, [msg.data.drmProvider, brandName]);
|
|
let anchorId = "eme-notification-icon";
|
|
|
|
let mainAction = {
|
|
label: gNavigatorBundle.getString("emeNotifications.drmContentPlaying.button.label"),
|
|
accessKey: gNavigatorBundle.getString("emeNotifications.drmContentPlaying.button.accesskey"),
|
|
callback: function() { openPreferences("paneContent"); },
|
|
dismiss: true
|
|
};
|
|
let options = {
|
|
dismissed: true,
|
|
eventCallback: aTopic => aTopic == "swapping",
|
|
};
|
|
PopupNotifications.show(browser, notificationId, message, anchorId, mainAction, null, options);
|
|
};
|
|
|
|
window.messageManager.addMessageListener("EMEVideo:MetadataLoaded", gEMEListener);
|
|
window.addEventListener("unload", function() {
|
|
window.messageManager.removeMessageListener("EMEVideo:MetadataLoaded", gEMEListener);
|
|
}, false);
|