Bug 885796 - WebRTC doesn't have UI to stop sharing camera nor microphone, r=dolske, ui-r=Boriss.
authorFlorian Quèze <florian@queze.net>
Thu, 23 Jan 2014 11:50:03 +0100
changeset 180928 815d5970e94759b3978142cba323fa6913f8e869
parent 180927 22737775ef328cbf76553a1f6c71df97517c17e4
child 180929 2da09980b901b664f82477654fdf6c0cc070aa51
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, Boriss
bugs885796
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 885796 - WebRTC doesn't have UI to stop sharing camera nor microphone, r=dolske, ui-r=Boriss.
browser/locales/en-US/chrome/browser/browser.properties
browser/modules/webrtcUI.jsm
--- a/browser/locales/en-US/chrome/browser/browser.properties
+++ b/browser/locales/en-US/chrome/browser/browser.properties
@@ -472,16 +472,20 @@ getUserMedia.noVideo.label = No Video
 getUserMedia.noAudio.label = No Audio
 getUserMedia.shareSelectedDevices.label = Share Selected Device;Share Selected Devices
 getUserMedia.shareSelectedDevices.accesskey = S
 getUserMedia.denyRequest.label = Don't Share
 getUserMedia.denyRequest.accesskey = D
 getUserMedia.sharingCamera.message2 = You are currently sharing your camera with this page.
 getUserMedia.sharingMicrophone.message2 = You are currently sharing your microphone with this page.
 getUserMedia.sharingCameraAndMicrophone.message2 = You are currently sharing your camera and microphone with this page.
+getUserMedia.continueSharing.label = Continue Sharing
+getUserMedia.continueSharing.accesskey = C
+getUserMedia.stopSharing.label = Stop Sharing
+getUserMedia.stopSharing.accesskey = S
 
 # Mixed Content Blocker Doorhanger Notification
 # LOCALIZATION NOTE - %S is brandShortName
 mixedContentBlocked.message = %S has blocked content that isn't secure.
 mixedContentBlocked.keepBlockingButton.label = Keep Blocking
 mixedContentBlocked.keepBlockingButton.accesskey = B
 mixedContentBlocked.unblock.label = Disable Protection on This Page
 mixedContentBlocked.unblock.accesskey = D
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -246,19 +246,36 @@ function showBrowserSpecificIndicator(aB
     Cu.reportError("showBrowserSpecificIndicator: got neither video nor audio access");
     return;
   }
 
   let chromeWin = aBrowser.ownerDocument.defaultView;
   let stringBundle = chromeWin.gNavigatorBundle;
 
   let message = stringBundle.getString("getUserMedia.sharing" + captureState + ".message2");
-  let mainAction = null;
-  let secondaryActions = null;
+
+  let windowId = aBrowser.contentWindow
+                         .QueryInterface(Ci.nsIInterfaceRequestor)
+                         .getInterface(Ci.nsIDOMWindowUtils)
+                         .currentInnerWindowID;
+  let mainAction = {
+    label: stringBundle.getString("getUserMedia.continueSharing.label"),
+    accessKey: stringBundle.getString("getUserMedia.continueSharing.accesskey"),
+    callback: function () {},
+    dismiss: true
+  };
+  let secondaryActions = [{
+    label: stringBundle.getString("getUserMedia.stopSharing.label"),
+    accessKey: stringBundle.getString("getUserMedia.stopSharing.accesskey"),
+    callback: function () {
+      Services.obs.notifyObservers(null, "getUserMedia:revoke", windowId);
+    }
+  }];
   let options = {
+    hideNotNow: true,
     dismissed: true,
     eventCallback: function(aTopic) aTopic == "swapping"
   };
   chromeWin.PopupNotifications.show(aBrowser, "webRTC-sharingDevices", message,
                                     "webRTC-sharingDevices-notification-icon", mainAction,
                                     secondaryActions, options);
 }