diff --git a/static/js/services/screensharing.js b/static/js/services/screensharing.js index 722b7bc4..5a5f572b 100644 --- a/static/js/services/screensharing.js +++ b/static/js/services/screensharing.js @@ -20,10 +20,22 @@ */ "use strict"; -define(['underscore', 'webrtc.adapter'], function(_) { +define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter'], function(_, screenshareDialogFF) { + + var screenshareDialogFFController = ["$scope", "$modalInstance", "data", function($scope, $modalInstance, data) { + $scope.data = data; + $scope.cancel = function() { + $modalInstance.close(null); + }; + $scope.ok = function() { + $modalInstance.close($scope.data.selection); + }; + }]; // screensharing - return ["$window", "$q", "$timeout", "chromeExtension", function($window, $q, $timeout, chromeExtension) { + return ["$window", "$q", "$timeout", "chromeExtension", "dialogs", "$templateCache", function($window, $q, $timeout, chromeExtension, dialogs, $templateCache) { + + $templateCache.put('/dialogs/screensharedialogff.html', screenshareDialogFF); var Screensharing = function() { this.autoinstall = false; @@ -131,11 +143,20 @@ define(['underscore', 'webrtc.adapter'], function(_) { // To work, the current domain must be whitelisted in // media.getusermedia.screensharing.allowed_domains (about:config). // See https://wiki.mozilla.org/Screensharing for reference. - var d = $q.defer() - var opts = _.extend({ - mediaSource: "screen" - }, options); - d.resolve(opts); + var d = $q.defer(); + var dlg = dialogs.create('/dialogs/screensharedialogff.html', screenshareDialogFFController, {selection: "screen"}, {}); + dlg.result.then(function(source) { + if (source) { + var opts = _.extend({ + mediaSource: source + }, options); + d.resolve(opts); + } else { + d.resolve(null); + } + }, function(err) { + d.resolve(null); + }); return d.promise; }; } diff --git a/static/partials/screensharedialogff.html b/static/partials/screensharedialogff.html new file mode 100644 index 00000000..86a56687 --- /dev/null +++ b/static/partials/screensharedialogff.html @@ -0,0 +1,22 @@ +
+ + + +
\ No newline at end of file