mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1111148 - show doorhanger for EME being played back, r=florian
This commit is contained in:
parent
2f6df40d58
commit
7a6656d945
36
browser/base/content/browser-eme.js
Normal file
36
browser/base/content/browser-eme.js
Normal file
@ -0,0 +1,36 @@
|
||||
# -*- 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);
|
@ -214,6 +214,7 @@ let gInitialPages = [
|
||||
#include browser-ctrlTab.js
|
||||
#include browser-customization.js
|
||||
#include browser-devedition.js
|
||||
#include browser-eme.js
|
||||
#include browser-feeds.js
|
||||
#include browser-fullScreen.js
|
||||
#include browser-fullZoom.js
|
||||
|
@ -822,6 +822,7 @@
|
||||
<image id="servicesInstall-notification-icon" class="notification-anchor-icon" role="button"/>
|
||||
<image id="translate-notification-icon" class="notification-anchor-icon" role="button"/>
|
||||
<image id="translated-notification-icon" class="notification-anchor-icon" role="button"/>
|
||||
<image id="eme-notification-icon" class="notification-anchor-icon" role="button"/>
|
||||
</box>
|
||||
<!-- Use onclick instead of normal popup= syntax since the popup
|
||||
code fires onmousedown, and hence eats our favicon drag events.
|
||||
|
@ -8,6 +8,7 @@ let {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/ContentWebRTC.jsm");
|
||||
Cu.import("resource:///modules/ContentObservers.jsm");
|
||||
Cu.import("resource://gre/modules/InlineSpellChecker.jsm");
|
||||
Cu.import("resource://gre/modules/InlineSpellCheckerContent.jsm");
|
||||
|
||||
|
@ -591,6 +591,11 @@ getUserMedia.sharingMenuMicrophoneWindow = %S (microphone and window)
|
||||
# origin for the sharing menu if no readable origin could be deduced from the URL.
|
||||
getUserMedia.sharingMenuUnknownHost = Unknown origin
|
||||
|
||||
# LOCALIZATION NOTE(emeNotifications.drmContentPlaying.message): %1$S is the vendor name of the DRM that's in use, %2$S is brandShortName.
|
||||
emeNotifications.drmContentPlaying.message = Some audio or video on this site uses %1$S DRM software, which may limit what %2$S can let you do with it.
|
||||
emeNotifications.drmContentPlaying.button.label = Configure…
|
||||
emeNotifications.drmContentPlaying.button.accesskey = C
|
||||
|
||||
# LOCALIZATION NOTE - %S is brandShortName
|
||||
slowStartup.message = %S seems slow… to… start.
|
||||
slowStartup.helpButton.label = Learn How to Speed It Up
|
||||
|
47
browser/modules/ContentObservers.jsm
Normal file
47
browser/modules/ContentObservers.jsm
Normal file
@ -0,0 +1,47 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
/**
|
||||
* This module is for small observers that we want to register once per content
|
||||
* process, usually in order to forward content-based observer service notifications
|
||||
* to the chrome process through message passing. Using a JSM avoids having them
|
||||
* in content.js and thereby registering N observers for N open tabs, which is bad
|
||||
* for perf.
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
this.EXPORTED_SYMBOLS = [];
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let gEMEUIObserver = function(subject, topic, data) {
|
||||
let win = subject.ownerDocument.defaultView.top;
|
||||
let mm = getMessageManagerForWindow(win);
|
||||
if (mm) {
|
||||
mm.sendAsyncMessage("EMEVideo:MetadataLoaded", {
|
||||
// bug 1129370 covers making this the actual DRM provider inferred from
|
||||
// either |subject| or |data| here.
|
||||
drmProvider: "Adobe"
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function getMessageManagerForWindow(aContentWindow) {
|
||||
let ir = aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDocShell)
|
||||
.sameTypeRootTreeItem
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor);
|
||||
try {
|
||||
// If e10s is disabled, this throws NS_NOINTERFACE for closed tabs.
|
||||
return ir.getInterface(Ci.nsIContentFrameMessageManager);
|
||||
} catch(e if e.result == Cr.NS_NOINTERFACE) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Services.obs.addObserver(gEMEUIObserver, "media-eme-metadataloaded", false);
|
@ -16,6 +16,7 @@ EXTRA_JS_MODULES += [
|
||||
'Chat.jsm',
|
||||
'ContentClick.jsm',
|
||||
'ContentLinkHandler.jsm',
|
||||
'ContentObservers.jsm',
|
||||
'ContentSearch.jsm',
|
||||
'ContentWebRTC.jsm',
|
||||
'CustomizationTabPreloader.jsm',
|
||||
|
@ -2185,6 +2185,17 @@ chatbox {
|
||||
border-top-right-radius: 2.5px;
|
||||
}
|
||||
|
||||
/* EME notifications */
|
||||
|
||||
.popup-notification-icon[popupid="drmContentPlaying"],
|
||||
#eme-notification-icon {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains");
|
||||
}
|
||||
|
||||
#eme-notification-icon:hover:active {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains-pressed");
|
||||
}
|
||||
|
||||
/* Customization mode */
|
||||
|
||||
%include ../shared/customizableui/customizeMode.inc.css
|
||||
|
@ -30,6 +30,7 @@ browser.jar:
|
||||
skin/classic/browser/content-contextmenu.svg
|
||||
skin/classic/browser/dots.png (../shared/dots.png)
|
||||
skin/classic/browser/dots@2x.png (../shared/dots@2x.png)
|
||||
skin/classic/browser/drm-icon.svg (../shared/drm-icon.svg)
|
||||
* skin/classic/browser/engineManager.css
|
||||
skin/classic/browser/fullscreen-darknoise.png
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
|
@ -4612,6 +4612,17 @@ window > chatbox {
|
||||
border-bottom-right-radius: @toolbarbuttonCornerRadius@;
|
||||
}
|
||||
|
||||
/* EME notifications */
|
||||
|
||||
.popup-notification-icon[popupid="drmContentPlaying"],
|
||||
#eme-notification-icon {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains");
|
||||
}
|
||||
|
||||
#eme-notification-icon:hover:active {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains-pressed");
|
||||
}
|
||||
|
||||
/* Customization mode */
|
||||
|
||||
%include ../shared/customizableui/customizeMode.inc.css
|
||||
|
@ -30,6 +30,7 @@ browser.jar:
|
||||
skin/classic/browser/content-contextmenu.svg
|
||||
skin/classic/browser/dots.png (../shared/dots.png)
|
||||
skin/classic/browser/dots@2x.png (../shared/dots@2x.png)
|
||||
skin/classic/browser/drm-icon.svg (../shared/drm-icon.svg)
|
||||
* skin/classic/browser/engineManager.css (engineManager.css)
|
||||
skin/classic/browser/fullscreen-darknoise.png
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
|
47
browser/themes/shared/drm-icon.svg
Normal file
47
browser/themes/shared/drm-icon.svg
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
|
||||
<style>
|
||||
#chains > use > path {
|
||||
fill: url(#baseGradient);
|
||||
}
|
||||
#chains-pressed > use > path {
|
||||
fill: url(#pressedGradient);
|
||||
}
|
||||
|
||||
g:not(:target) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<defs>
|
||||
<linearGradient id="baseGradient" gradientUnits="userSpaceOnUse" x1="8" x2="8" y1="16" y2="0">
|
||||
<stop offset="0" style="stop-color:#808080"/>
|
||||
<stop offset="1" style="stop-color:#999999"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="pressedGradient" gradientUnits="userSpaceOnUse" x1="8" x2="8" y1="16" y2="0">
|
||||
<stop offset="0" style="stop-color:#4D4D4D"/>
|
||||
<stop offset="1" style="stop-color:#808080"/>
|
||||
</linearGradient>
|
||||
<path id="path1" d="M7.058,9.72c-0.245,0.245-0.62,0.27-0.834,0.056C6.01,9.562,6.035,9.186,6.28,8.942l0.218-0.218
|
||||
c-0.245-0.245-0.645-0.245-0.89,0L4.496,9.836c-0.245,0.245-0.245,0.645,0,0.89l0.779,0.779c0.245,0.245,0.645,0.245,0.89,0
|
||||
l1.112-1.112c0.245-0.245,0.245-0.645,0-0.89L7.058,9.72z"/>
|
||||
<path id="path2" d="M10.726,4.496c-0.245-0.245-0.645-0.245-0.89,0L8.723,5.608c-0.245,0.245-0.245,0.645,0,0.89
|
||||
L8.95,6.272c0.245-0.245,0.62-0.27,0.834-0.056s0.189,0.59-0.056,0.834L9.502,7.277c0.245,0.245,0.645,0.245,0.89,0l1.112-1.112
|
||||
c0.245-0.245,0.245-0.645,0-0.89L10.726,4.496z"/>
|
||||
<path id="path3" d="M8,0C3.582,0,0,3.582,0,8s3.582,8,8,8s8-3.582,8-8S12.418,0,8,0z M12.527,6.81l-1.489,1.489
|
||||
c-0.631,0.631-1.663,0.631-2.293,0L8.612,8.167L8.167,8.612l0.133,0.133c0.631,0.631,0.631,1.663,0,2.293L6.81,12.527
|
||||
c-0.631,0.631-1.663,0.631-2.293,0l-1.044-1.044c-0.631-0.631-0.631-1.663,0-2.293l1.489-1.489c0.631-0.631,1.663-0.631,2.293,0
|
||||
l0.133,0.133l0.445-0.445L7.701,7.255c-0.631-0.631-0.631-1.663,0-2.293L9.19,3.473c0.631-0.631,1.663-0.631,2.293,0l1.044,1.044
|
||||
C13.158,5.148,13.158,6.18,12.527,6.81z"/>
|
||||
</defs>
|
||||
<g id="chains">
|
||||
<use xlink:href="#path1"/>
|
||||
<use xlink:href="#path2"/>
|
||||
<use xlink:href="#path3"/>
|
||||
</g>
|
||||
<g id="chains-pressed">
|
||||
<use xlink:href="#path1"/>
|
||||
<use xlink:href="#path2"/>
|
||||
<use xlink:href="#path3"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.3 KiB |
@ -2807,6 +2807,17 @@ chatbox {
|
||||
border-top-right-radius: 2.5px;
|
||||
}
|
||||
|
||||
/* EME notifications */
|
||||
|
||||
.popup-notification-icon[popupid="drmContentPlaying"],
|
||||
#eme-notification-icon {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains");
|
||||
}
|
||||
|
||||
#eme-notification-icon:hover:active {
|
||||
list-style-image: url("chrome://browser/skin/drm-icon.svg#chains-pressed");
|
||||
}
|
||||
|
||||
/* Customization mode */
|
||||
|
||||
%include ../shared/customizableui/customizeMode.inc.css
|
||||
|
@ -32,6 +32,7 @@ browser.jar:
|
||||
skin/classic/browser/content-contextmenu.svg
|
||||
skin/classic/browser/dots.png (../shared/dots.png)
|
||||
skin/classic/browser/dots@2x.png (../shared/dots@2x.png)
|
||||
skin/classic/browser/drm-icon.svg (../shared/drm-icon.svg)
|
||||
* skin/classic/browser/engineManager.css
|
||||
skin/classic/browser/fullscreen-darknoise.png
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
@ -494,6 +495,7 @@ browser.jar:
|
||||
* skin/classic/aero/browser/content-contextmenu.svg
|
||||
skin/classic/aero/browser/dots.png (../shared/dots.png)
|
||||
skin/classic/aero/browser/dots@2x.png (../shared/dots@2x.png)
|
||||
skin/classic/aero/browser/drm-icon.svg (../shared/drm-icon.svg)
|
||||
* skin/classic/aero/browser/engineManager.css
|
||||
skin/classic/aero/browser/fullscreen-darknoise.png
|
||||
skin/classic/aero/browser/Geolocation-16.png
|
||||
|
Loading…
Reference in New Issue
Block a user