Bug 801068 - Add a "Don't Share" option for camera and microphone access requests; don't deny the request when dismissing the popup notification. r=anant

This commit is contained in:
Dão Gottwald 2012-10-24 01:15:36 +02:00
parent b434b489db
commit 96dc1b605f
2 changed files with 9 additions and 9 deletions

View File

@ -435,3 +435,5 @@ getUserMedia.shareSpecificMicrophone.label = Share Microphone: %S
getUserMedia.shareCameraAndMicrophone.message = Would you like to share your camera and microphone with %S?
getUserMedia.shareCameraAndMicrophone.label = Share Camera and Microphone
getUserMedia.shareCameraAndMicrophone.accesskey = S
getUserMedia.denyRequest.label = Don't Share
getUserMedia.denyRequest.accesskey = D

View File

@ -77,14 +77,11 @@ function prompt(aBrowser, aCallID, aAudioRequested, aVideoRequested, aDevices) {
let message = stringBundle.getFormattedString("getUserMedia." + requestType + ".message",
[ host ]);
let responseSent = false;
let mainAction = {
label: stringBundle.getString("getUserMedia." + requestType + ".label"),
accessKey: stringBundle.getString("getUserMedia." + requestType + ".accesskey"),
callback: function () {
Services.obs.notifyObservers(null, "getUserMedia:response:allow", aCallID);
responseSent = true;
}
};
@ -103,18 +100,19 @@ function prompt(aBrowser, aCallID, aAudioRequested, aVideoRequested, aDevices) {
accessKey: selectableDeviceNumber,
callback: function () {
Services.obs.notifyObservers(device, "getUserMedia:response:allow", aCallID);
responseSent = true;
}
});
}
}
secondaryActions.push({
label: stringBundle.getString("getUserMedia.denyRequest.label"),
accessKey: stringBundle.getString("getUserMedia.denyRequest.accesskey"),
callback: function () {
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aCallID);
}
});
let options = {
removeOnDismissal: true,
eventCallback: function (aType) {
if (!responseSent && aType == "removed")
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aCallID);
}
};
chromeWin.PopupNotifications.show(aBrowser, "webRTC-shareDevices", message,