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 366178 378bb4c456a2c1a302756d86391bff04bee50e9a
parent 366177 9e93d0cd42deb7886a5d6fb16475297cb8a23a44
child 520713 1cfc0893229214208d5bcd19cb1e184f39f87bfa
push id17915
push userjbruaroey@mozilla.com
push dateThu, 12 May 2016 04:09:13 +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");
   }
 }