Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on android. draft
authorJan-Ivar Bruaroey <jib@mozilla.com>
Thu, 05 May 2016 22:41:26 -0400
changeset 365500 0540b872ce87ee5655cca5008b00d06b0828f087
parent 365499 ba28459a4bfb2b1cd07456a4d2819a908f873c9c
child 365512 a4d4707128d36e402489b75dd315b3580ba8767d
push id17763
push userjbruaroey@mozilla.com
push dateTue, 10 May 2016 23:04:05 +0000
bugs802326
milestone49.0a1
Bug 802326 - remove "No Video" and "No Audio" choices in cam+mic permission prompt on android. MozReview-Commit-ID: DyYcKkbpBVl
mobile/android/chrome/content/WebrtcUI.js
--- a/mobile/android/chrome/content/WebrtcUI.js
+++ b/mobile/android/chrome/content/WebrtcUI.js
@@ -197,23 +197,21 @@ var WebrtcUI = {
         if (device.name.trim() == "") {
           defaultCount++;
           return Strings.browser.formatStringFromName("getUserMedia." + aType + ".default", [defaultCount], 1);
         }
         return device.name
       }, this);
   },
 
-  _addDevicesToOptions: function(aDevices, aType, aOptions, extraOptions) {
+  _addDevicesToOptions: function(aDevices, aType, aOptions) {
     if (aDevices.length) {
 
       // Filter out empty items from the list
       let list = this._getList(aDevices, aType);
-      if (extraOptions)
-        list = list.concat(extraOptions);
 
       if (list.length > 0) {
         aOptions.inputs.push({
           id: aType,
           type: "menulist",
           label: Strings.browser.GetStringFromName("getUserMedia." + aType + ".prompt"),
           values: list
         });
@@ -276,32 +274,22 @@ var WebrtcUI = {
       return;
 
     let uri = aContentWindow.document.documentURIObject;
     let host = uri.host;
     let requestor = BrowserApp.manifest ? "'" + BrowserApp.manifest.name  + "'" : host;
     let message = Strings.browser.formatStringFromName("getUserMedia.share" + requestType + ".message", [ requestor ], 1);
 
     let options = { inputs: [] };
-    // if the users only option would be to select "No Audio" or "No Video"
-    // i.e. we're only showing audio or only video and there is only one device for that type
-    // don't bother showing a menulist to select from
-    var extraItems = null;
     if (videoDevices.length > 1 || audioDevices.length > 0) {
-      // Only show the No Video option if there are also Audio devices to choose from
-      if (audioDevices.length > 0)
-        extraItems = [ Strings.browser.GetStringFromName("getUserMedia.videoSource.none") ];
       // videoSource is both the string used for l10n lookup and the object that will be returned
-      this._addDevicesToOptions(videoDevices, "videoSource", options, extraItems);
+      this._addDevicesToOptions(videoDevices, "videoSource", options);
     }
 
     if (audioDevices.length > 1 || videoDevices.length > 0) {
-      // Only show the No Audio option if there are also Video devices to choose from
-      if (videoDevices.length > 0)
-        extraItems = [ Strings.browser.GetStringFromName("getUserMedia.audioDevice.none") ];
-      this._addDevicesToOptions(audioDevices, "audioDevice", options, extraItems);
+      this._addDevicesToOptions(audioDevices, "audioDevice", options);
     }
 
     let buttons = this.getDeviceButtons(audioDevices, videoDevices, aCallID, uri);
 
     NativeWindow.doorhanger.show(message, "webrtc-request", buttons, BrowserApp.selectedTab.id, options, "WEBRTC");
   }
 }