Bug 1320375 - Remove webrtcUI.showSharingDoorhanger's obsolete aType parameter, r=johannh.

This commit is contained in:
Florian Quèze 2016-11-28 12:29:31 +01:00
Родитель 0211bb62b9
Коммит 72d3846cce
3 изменённых файлов: 7 добавлений и 29 удалений

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

@ -455,7 +455,7 @@ var gTests = [
ok(gIdentityHandler._identityPopup.hidden, "control center should be hidden");
if ("nsISystemStatusBar" in Ci) {
let activeStreams = webrtcUI.getActiveStreams(true, false, false);
webrtcUI.showSharingDoorhanger(activeStreams[0], "Devices");
webrtcUI.showSharingDoorhanger(activeStreams[0]);
}
else {
let win =

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

@ -88,16 +88,15 @@ function updateWindowAttr(attr, value) {
function onPopupMenuShowing(event) {
let popup = event.target;
let type = popup.getAttribute("type");
let activeStreams;
if (type == "Devices")
if (popup.getAttribute("type") == "Devices")
activeStreams = webrtcUI.getActiveStreams(true, true, false);
else
activeStreams = webrtcUI.getActiveStreams(false, false, true);
if (activeStreams.length == 1) {
webrtcUI.showSharingDoorhanger(activeStreams[0], type);
webrtcUI.showSharingDoorhanger(activeStreams[0]);
event.preventDefault();
return;
}
@ -118,9 +117,7 @@ function onPopupMenuHiding(event) {
}
function onPopupMenuCommand(event) {
let item = event.target;
webrtcUI.showSharingDoorhanger(item.stream,
item.parentNode.getAttribute("type"));
webrtcUI.showSharingDoorhanger(event.target.stream);
}
function onFirefoxButtonClick(event) {

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

@ -136,7 +136,7 @@ this.webrtcUI = {
this._streams = this._streams.filter(stream => stream.browser != aBrowser);
},
showSharingDoorhanger: function(aActiveStream, aType) {
showSharingDoorhanger: function(aActiveStream) {
let browserWindow = aActiveStream.browser.ownerGlobal;
if (aActiveStream.tab) {
browserWindow.gBrowser.selectedTab = aActiveStream.tab;
@ -697,12 +697,7 @@ function getGlobalIndicator() {
.getService(Ci.nsISystemStatusBar),
_command: function(aEvent) {
let type = this.getAttribute("type");
if (type == "Camera" || type == "Microphone")
type = "Devices";
else if (type == "Window" || type == "Application" || type == "Browser")
type = "Screen";
webrtcUI.showSharingDoorhanger(aEvent.target.stream, type);
webrtcUI.showSharingDoorhanger(aEvent.target.stream);
},
_popupShowing: function(aEvent) {
@ -735,7 +730,6 @@ function getGlobalIndicator() {
menuitem = this.ownerDocument.createElement("menuitem");
menuitem.setAttribute("label",
bundle.GetStringFromName("webrtcIndicator.controlSharing.menuitem"));
menuitem.setAttribute("type", type);
menuitem.stream = stream;
menuitem.addEventListener("command", indicator._command);
@ -757,7 +751,6 @@ function getGlobalIndicator() {
labelId = "webrtcIndicator.controlSharingOn.menuitem";
label = stream.browser.contentTitle || stream.uri;
item.setAttribute("label", bundle.formatStringFromName(labelId, [label], 1));
item.setAttribute("type", type);
item.stream = stream;
item.addEventListener("command", indicator._command);
this.appendChild(item);
@ -832,17 +825,6 @@ function onTabSharingMenuPopupShowing(e) {
let menuitem = doc.createElement("menuitem");
menuitem.setAttribute("label", bundle.getFormattedString(stringName, [origin]));
menuitem.stream = streamInfo;
// We can only open 1 doorhanger at a time. Guessing that users would be
// most eager to control screen/window/app sharing, and only then
// camera/microphone sharing, in that (decreasing) order of priority.
let doorhangerType;
if ((/Screen|Window|Application/).test(stringName)) {
doorhangerType = "Screen";
} else {
doorhangerType = "Devices";
}
menuitem.setAttribute("doorhangertype", doorhangerType);
menuitem.addEventListener("command", onTabSharingMenuPopupCommand);
e.target.appendChild(menuitem);
}
@ -854,8 +836,7 @@ function onTabSharingMenuPopupHiding(e) {
}
function onTabSharingMenuPopupCommand(e) {
let type = e.target.getAttribute("doorhangertype");
webrtcUI.showSharingDoorhanger(e.target.stream, type);
webrtcUI.showSharingDoorhanger(e.target.stream);
}
function showOrCreateMenuForWindow(aWindow) {