Bug 1206233 - Removed the old device/screen sharing doorhangers, r=johannh.

This commit is contained in:
Florian Quèze 2016-08-09 22:50:53 +02:00
Родитель ee275bb154
Коммит 77c40e0e1c
5 изменённых файлов: 9 добавлений и 185 удалений

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

@ -747,16 +747,10 @@
aria-label="&urlbar.webNotsNotificationAnchor3.label;"/>
<image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon camera-icon" role="button"
aria-label="&urlbar.webRTCShareDevicesNotificationAnchor.label;"/>
<image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon camera-icon in-use" role="button"
aria-label="&urlbar.webRTCSharingDevicesNotificationAnchor.label;"/>
<image id="webRTC-shareMicrophone-notification-icon" class="notification-anchor-icon microphone-icon" role="button"
aria-label="&urlbar.webRTCShareMicrophoneNotificationAnchor.label;"/>
<image id="webRTC-sharingMicrophone-notification-icon" class="notification-anchor-icon microphone-icon in-use" role="button"
aria-label="&urlbar.webRTCSharingMicrophoneNotificationAnchor.label;"/>
<image id="webRTC-shareScreen-notification-icon" class="notification-anchor-icon screen-icon" role="button"
aria-label="&urlbar.webRTCShareScreenNotificationAnchor.label;"/>
<image id="webRTC-sharingScreen-notification-icon" class="notification-anchor-icon screen-icon in-use" role="button"
aria-label="&urlbar.webRTCSharingScreenNotificationAnchor.label;"/>
<image id="pointerLock-notification-icon" class="notification-anchor-icon pointerLock-icon" role="button"
aria-label="&urlbar.pointerLockNotificationAnchor.label;"/>
<image id="servicesInstall-notification-icon" class="notification-anchor-icon service-icon" role="button"

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

@ -220,11 +220,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY urlbar.webNotsNotificationAnchor3.label "Change whether you can receive notifications from the site">
<!ENTITY urlbar.webRTCShareDevicesNotificationAnchor.label "Manage sharing your camera and/or microphone with the site">
<!ENTITY urlbar.webRTCSharingDevicesNotificationAnchor.label "You are sharing your camera and/or microphone with the site">
<!ENTITY urlbar.webRTCShareMicrophoneNotificationAnchor.label "Manage sharing your microphone with the site">
<!ENTITY urlbar.webRTCSharingMicrophoneNotificationAnchor.label "You are sharing your microphone with the site">
<!ENTITY urlbar.webRTCShareScreenNotificationAnchor.label "Manage sharing your windows or screen with the site">
<!ENTITY urlbar.webRTCSharingScreenNotificationAnchor.label "You are sharing a window or your screen with the site">
<!ENTITY urlbar.pointerLockNotificationAnchor.label "Change whether the site can hide the pointer">
<!ENTITY urlbar.servicesNotificationAnchor.label "View the service install message">

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

@ -519,18 +519,6 @@ getUserMedia.denyRequest.label = Dont Share
getUserMedia.denyRequest.accesskey = D
getUserMedia.never.label = Never Share
getUserMedia.never.accesskey = N
getUserMedia.sharingCamera.message2 = You are currently sharing your camera with this page.
getUserMedia.sharingMicrophone.message2 = You are currently sharing your microphone with this page.
getUserMedia.sharingCameraAndMicrophone.message2 = You are currently sharing your camera and microphone with this page.
getUserMedia.sharingApplication.message = You are currently sharing an application with this page.
getUserMedia.sharingScreen.message = You are currently sharing your screen with this page.
getUserMedia.sharingWindow.message = You are currently sharing a window with this page.
getUserMedia.sharingBrowser.message = You are currently sharing a tab with this page.
getUserMedia.sharingAudioCapture.message = You are currently sharing a tabs audio with this page.
getUserMedia.continueSharing.label = Continue Sharing
getUserMedia.continueSharing.accesskey = C
getUserMedia.stopSharing.label = Stop Sharing
getUserMedia.stopSharing.accesskey = S
getUserMedia.sharingMenu.label = Tabs sharing devices
getUserMedia.sharingMenu.accesskey = d

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

@ -136,21 +136,19 @@ this.webrtcUI = {
aActiveStream.browser.focus();
}
browserWindow.focus();
let PopupNotifications = browserWindow.PopupNotifications;
let notif = PopupNotifications.getNotification("webRTC-sharing" + aType,
aActiveStream.browser);
let identityBox = browserWindow.document.getElementById("identity-box");
if (AppConstants.platform == "macosx" && !Services.focus.activeWindow) {
browserWindow.addEventListener("activate", function onActivate() {
browserWindow.removeEventListener("activate", onActivate);
Services.tm.mainThread.dispatch(function() {
notif.reshow();
identityBox.click();
}, Ci.nsIThread.DISPATCH_NORMAL);
});
Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport)
.activateApplication(true);
return;
}
notif.reshow();
identityBox.click();
},
updateMainActionLabel: function(aMenuList) {
@ -237,7 +235,9 @@ this.webrtcUI = {
webrtcUI._streams.splice(index, 1);
else
webrtcUI._streams[index] = {browser: aMessage.target, state: aMessage.data};
updateBrowserSpecificIndicator(aMessage.target, aMessage.data);
let tabbrowser = aMessage.target.ownerGlobal.gBrowser;
if (tabbrowser)
tabbrowser.setBrowserSharing(aMessage.target, aMessage.data);
break;
case "child-process-shutdown":
webrtcUI.processIndicators.delete(aMessage.target);
@ -866,136 +866,3 @@ function updateIndicators(data, target) {
gIndicatorWindow = null;
}
}
function updateBrowserSpecificIndicator(aBrowser, aState) {
let chromeWin = aBrowser.ownerGlobal;
let tabbrowser = chromeWin.gBrowser;
if (tabbrowser) {
tabbrowser.setBrowserSharing(aBrowser, aState);
}
let captureState;
if (aState.camera && aState.microphone) {
captureState = "CameraAndMicrophone";
} else if (aState.camera) {
captureState = "Camera";
} else if (aState.microphone) {
captureState = "Microphone";
}
let stringBundle = chromeWin.gNavigatorBundle;
let windowId = aState.windowId;
let notification; // Used by action callbacks.
let mainAction = {
label: stringBundle.getString("getUserMedia.continueSharing.label"),
accessKey: stringBundle.getString("getUserMedia.continueSharing.accesskey"),
callback: function () {},
dismiss: true
};
let secondaryActions = [{
label: stringBundle.getString("getUserMedia.stopSharing.label"),
accessKey: stringBundle.getString("getUserMedia.stopSharing.accesskey"),
callback: function () {
let uris = aBrowser._devicePermissionURIs || [];
uris = uris.concat(Services.io.newURI(aState.documentURI, null, null));
let perms = Services.perms;
for (let uri of uris) {
if (aState.camera &&
perms.testExactPermission(uri, "camera") == perms.ALLOW_ACTION)
perms.remove(uri, "camera");
if (aState.microphone &&
perms.testExactPermission(uri, "microphone") == perms.ALLOW_ACTION)
perms.remove(uri, "microphone");
}
let mm = notification.browser.messageManager;
mm.sendAsyncMessage("webrtc:StopSharing", windowId);
}
}];
let options = {
hideNotNow: true,
dismissed: true,
eventCallback: function(aTopic, aNewBrowser) {
if (aTopic == "shown") {
let popupId = captureState == "Microphone" ? "Microphone" : "Devices";
this.browser.ownerDocument
.getElementById("webRTC-sharingDevices-notification")
.setAttribute("popupid", "webRTC-sharing" + popupId);
}
if (aTopic == "swapping") {
webrtcUI.swapBrowserForNotification(this.browser, aNewBrowser);
return true;
}
return false;
}
};
if (captureState) {
let anchorId = captureState == "Microphone" ? "webRTC-sharingMicrophone-notification-icon"
: "webRTC-sharingDevices-notification-icon";
let message = stringBundle.getString("getUserMedia.sharing" + captureState + ".message2");
notification =
chromeWin.PopupNotifications.show(aBrowser, "webRTC-sharingDevices", message,
anchorId, mainAction, secondaryActions, options);
}
else {
removeBrowserNotification(aBrowser, "webRTC-sharingDevices");
aBrowser._devicePermissionURIs = null;
}
// Now handle the screen sharing indicator.
if (!aState.screen) {
removeBrowserNotification(aBrowser, "webRTC-sharingScreen");
return;
}
let screenSharingNotif; // Used by action callbacks.
let isBrowserSharing = aState.screen == "Browser";
options = {
hideNotNow: !isBrowserSharing,
dismissed: true,
eventCallback: function(aTopic, aNewBrowser) {
if (aTopic == "shown") {
this.browser.ownerDocument
.getElementById("webRTC-sharingScreen-notification")
.setAttribute("popupid", "webRTC-sharingScreen");
}
if (aTopic == "swapping") {
webrtcUI.swapBrowserForNotification(this.browser, aNewBrowser);
return true;
}
return false;
}
};
secondaryActions = [{
label: stringBundle.getString("getUserMedia.stopSharing.label"),
accessKey: stringBundle.getString("getUserMedia.stopSharing.accesskey"),
callback: function () {
let mm = screenSharingNotif.browser.messageManager;
mm.sendAsyncMessage("webrtc:StopSharing", "screen:" + windowId);
}
}];
// Ending browser-sharing from the gUM doorhanger is not supported at the moment.
// See bug 1142091.
if (isBrowserSharing)
mainAction = secondaryActions = null;
// If we are sharing both a window and the screen, we show 'Screen'.
let stringId = "getUserMedia.sharing" + aState.screen;
screenSharingNotif =
chromeWin.PopupNotifications.show(aBrowser, "webRTC-sharingScreen",
stringBundle.getString(stringId + ".message"),
"webRTC-sharingScreen-notification-icon",
mainAction, secondaryActions, options);
}
function removeBrowserNotification(aBrowser, aNotificationId) {
let win = aBrowser.ownerGlobal;
let notification =
win.PopupNotifications.getNotification(aNotificationId, aBrowser);
if (notification)
win.PopupNotifications.remove(notification);
}

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

@ -41,16 +41,12 @@
margin-inline-end: 10px;
}
#notification-popup-box > .notification-anchor-icon:not(.in-use):hover {
#notification-popup-box > .notification-anchor-icon:hover {
fill: #606060;
}
/* INDIVIDUAL NOTIFICATIONS */
/* For the moment we apply the color filter only on the icons listed here.
The first two selectors are used by socialchat.xml (bug 1275558). */
.webRTC-sharingDevices-notification-icon,
.webRTC-sharingMicrophone-notification-icon,
.camera-icon,
.geo-icon,
.indexedDB-icon,
@ -69,22 +65,11 @@
.popup-notification-icon[popupid="webRTC-shareDevices"],
.popup-notification-icon[popupid="webRTC-shareMicrophone"],
.popup-notification-icon[popupid="webRTC-shareScreen"],
.popup-notification-icon[popupid="webRTC-sharingDevices"],
.popup-notification-icon[popupid="webRTC-sharingMicrophone"],
.popup-notification-icon[popupid="webRTC-sharingScreen"],
.popup-notification-icon[popupid="web-notifications"] {
filter: url(chrome://browser/skin/filters.svg#fill);
fill: #999;
}
/* The first two selectors are used by socialchat.xml (bug 1275558). The
notifications in the chat window are only shown when they are in use. */
.webRTC-sharingDevices-notification-icon,
.webRTC-sharingMicrophone-notification-icon,
.in-use {
fill: #fea01b;
}
.popup-notification-icon[popupid="web-notifications"],
.desktop-notification-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#desktop-notification);
@ -146,11 +131,8 @@
transform: scaleX(-1);
}
/* The first selector is used by socialchat.xml (bug 1275558). */
.webRTC-sharingDevices-notification-icon,
.camera-icon,
.popup-notification-icon[popupid="webRTC-shareDevices"],
.popup-notification-icon[popupid="webRTC-sharingDevices"] {
.popup-notification-icon[popupid="webRTC-shareDevices"] {
list-style-image: url(chrome://browser/skin/notification-icons.svg#camera);
}
@ -158,8 +140,6 @@
list-style-image: url(chrome://browser/skin/notification-icons.svg#camera-blocked);
}
/* The first selector is used by socialchat.xml (bug 1275558). */
.webRTC-sharingMicrophone-notification-icon,
.microphone-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#microphone);
}
@ -168,13 +148,11 @@
list-style-image: url(chrome://browser/skin/notification-icons.svg#microphone-blocked);
}
.popup-notification-icon[popupid="webRTC-shareMicrophone"],
.popup-notification-icon[popupid="webRTC-sharingMicrophone"] {
.popup-notification-icon[popupid="webRTC-shareMicrophone"] {
list-style-image: url(chrome://browser/skin/notification-icons.svg#microphone-detailed);
}
.popup-notification-icon[popupid="webRTC-shareScreen"],
.popup-notification-icon[popupid="webRTC-sharingScreen"],
.screen-icon {
list-style-image: url(chrome://browser/skin/notification-icons.svg#screen);
}