зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1037405 - adapt the label of the main action in the screensharing doorhanger prompt, r=Gijs.
--HG-- extra : rebase_source : 4cf00c04c99814c2bb040ff65d3d37793ac59976
This commit is contained in:
Родитель
4d36509871
Коммит
d7167bfa22
|
@ -24,9 +24,11 @@
|
|||
<label value="&getUserMedia.selectWindowOrScreen.label;"
|
||||
accesskey="&getUserMedia.selectWindowOrScreen.accesskey;"
|
||||
control="webRTC-selectWindow-menulist"/>
|
||||
<menulist id="webRTC-selectWindow-menulist">
|
||||
<menulist id="webRTC-selectWindow-menulist"
|
||||
oncommand="WebrtcIndicator.UIModule.updateMainActionLabel(this);">
|
||||
<menupopup id="webRTC-selectWindow-menupopup"/>
|
||||
</menulist>
|
||||
<description id="webRTC-all-windows-shared" hidden="true">&getUserMedia.allWindowsShared.message;</description>
|
||||
</popupnotificationcontent>
|
||||
|
||||
<popupnotificationcontent id="webRTC-selectMicrophone" orient="vertical">
|
||||
|
|
|
@ -713,6 +713,7 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
|||
<!ENTITY getUserMedia.selectWindowOrScreen.accesskey "W">
|
||||
<!ENTITY getUserMedia.selectMicrophone.label "Microphone to share:">
|
||||
<!ENTITY getUserMedia.selectMicrophone.accesskey "M">
|
||||
<!ENTITY getUserMedia.allWindowsShared.message "All visible windows on your screen will be shared.">
|
||||
|
||||
<!ENTITY webrtcIndicatorButton.label "Camera / Microphone Access">
|
||||
<!ENTITY webrtcIndicatorButton.tooltip "Display sites you are currently sharing your camera or microphone with">
|
||||
|
|
|
@ -503,6 +503,9 @@ getUserMedia.shareEntireScreen.label = Entire screen
|
|||
# The number of devices can be either one or two.
|
||||
getUserMedia.shareSelectedDevices.label = Share Selected Device;Share Selected Devices
|
||||
getUserMedia.shareSelectedDevices.accesskey = S
|
||||
getUserMedia.shareScreen.label = Share Screen
|
||||
getUserMedia.shareWindow.label = Share Selected Window
|
||||
getUserMedia.shareSelectedItems.label = Share Selected Items
|
||||
getUserMedia.always.label = Always Share
|
||||
getUserMedia.always.accesskey = A
|
||||
getUserMedia.denyRequest.label = Don't Share
|
||||
|
|
|
@ -52,6 +52,22 @@ this.webrtcUI = {
|
|||
});
|
||||
}
|
||||
return activeStreams;
|
||||
},
|
||||
|
||||
updateMainActionLabel: function(aMenuList) {
|
||||
let type = aMenuList.selectedItem.getAttribute("devicetype");
|
||||
let document = aMenuList.ownerDocument;
|
||||
document.getElementById("webRTC-all-windows-shared").hidden = type != "Screen";
|
||||
|
||||
// If we are also requesting audio in addition to screen sharing,
|
||||
// always use a generic label.
|
||||
if (!document.getElementById("webRTC-selectMicrophone").hidden)
|
||||
type = "";
|
||||
|
||||
let bundle = document.defaultView.gNavigatorBundle;
|
||||
let stringId = "getUserMedia.share" + (type || "SelectedItems") + ".label";
|
||||
let popupnotification = aMenuList.parentNode.parentNode;
|
||||
popupnotification.setAttribute("buttonlabel", bundle.getString(stringId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,9 +152,16 @@ function prompt(aContentWindow, aCallID, aAudio, aVideo, aDevices, aSecure) {
|
|||
let stringId = "getUserMedia.share" + requestTypes.join("And") + ".message";
|
||||
let message = stringBundle.getFormattedString(stringId, [uri.host]);
|
||||
|
||||
let mainLabel;
|
||||
if (sharingScreen) {
|
||||
mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label");
|
||||
}
|
||||
else {
|
||||
let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label");
|
||||
mainLabel = PluralForm.get(requestTypes.length, string);
|
||||
}
|
||||
let mainAction = {
|
||||
label: PluralForm.get(requestTypes.length,
|
||||
stringBundle.getString("getUserMedia.shareSelectedDevices.label")),
|
||||
label: mainLabel,
|
||||
accessKey: stringBundle.getString("getUserMedia.shareSelectedDevices.accesskey"),
|
||||
// The real callback will be set during the "showing" event. The
|
||||
// empty function here is so that PopupNotifications.show doesn't
|
||||
|
@ -267,7 +290,7 @@ function prompt(aContentWindow, aCallID, aAudio, aVideo, aDevices, aSecure) {
|
|||
menupopup.appendChild(chromeDoc.createElement("menuseparator"));
|
||||
addDeviceToList(menupopup,
|
||||
stringBundle.getString("getUserMedia.shareEntireScreen.label"),
|
||||
i);
|
||||
i, "Screen");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -280,16 +303,22 @@ function prompt(aContentWindow, aCallID, aAudio, aVideo, aDevices, aSecure) {
|
|||
menupopup.appendChild(chromeDoc.createElement("menuseparator"));
|
||||
separatorNeeded = false;
|
||||
}
|
||||
addDeviceToList(menupopup, devices[i].name, i);
|
||||
addDeviceToList(menupopup, devices[i].name, i, "Window");
|
||||
}
|
||||
}
|
||||
|
||||
// Always re-select the "No Window or Screen" item.
|
||||
chromeDoc.getElementById("webRTC-selectWindow-menulist").removeAttribute("value");
|
||||
chromeDoc.getElementById("webRTC-all-windows-shared").hidden = true;
|
||||
}
|
||||
|
||||
function addDeviceToList(menupopup, deviceName, deviceIndex) {
|
||||
function addDeviceToList(menupopup, deviceName, deviceIndex, type) {
|
||||
let menuitem = chromeDoc.createElement("menuitem");
|
||||
menuitem.setAttribute("value", deviceIndex);
|
||||
menuitem.setAttribute("label", deviceName);
|
||||
menuitem.setAttribute("tooltiptext", deviceName);
|
||||
if (type)
|
||||
menuitem.setAttribute("devicetype", type);
|
||||
menupopup.appendChild(menuitem);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче