From 2ac6a24abe35f9e32a2e7178b8ff1c47a2b4fa68 Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Fri, 20 Feb 2015 16:41:02 +0100 Subject: [PATCH] Bug 1131584: add 'Share my Tabs' button to the screenshare dropdown menu in the conversation window. r=Standard8 --- .../loop/content/shared/js/actions.js | 2 ++ .../loop/content/shared/js/otSdkDriver.js | 5 ++--- .../loop/content/shared/js/views.js | 15 ++++++++++++- .../loop/content/shared/js/views.jsx | 15 ++++++++++++- .../loop/test/shared/otSdkDriver_test.js | 16 ++++++++++---- .../components/loop/test/shared/views_test.js | 21 +++++++++++++++++-- .../en-US/chrome/browser/loop/loop.properties | 1 + 7 files changed, 64 insertions(+), 11 deletions(-) diff --git a/browser/components/loop/content/shared/js/actions.js b/browser/components/loop/content/shared/js/actions.js index 7ff1951d7f7b..59529ac83d65 100644 --- a/browser/components/loop/content/shared/js/actions.js +++ b/browser/components/loop/content/shared/js/actions.js @@ -202,6 +202,8 @@ loop.shared.actions = (function() { * Used to start a screen share. */ StartScreenShare: Action.define("startScreenShare", { + // The part of the screen to share, e.g. "window" or "browser". + type: String }), /** diff --git a/browser/components/loop/content/shared/js/otSdkDriver.js b/browser/components/loop/content/shared/js/otSdkDriver.js index 4ee8c59068e0..d5e688036558 100644 --- a/browser/components/loop/content/shared/js/otSdkDriver.js +++ b/browser/components/loop/content/shared/js/otSdkDriver.js @@ -89,14 +89,13 @@ loop.OTSdkDriver = (function() { /** * Initiates a screen sharing publisher. */ - startScreenShare: function() { + startScreenShare: function(actionData) { this.dispatcher.dispatch(new sharedActions.ScreenSharingState({ state: SCREEN_SHARE_STATES.PENDING })); var config = this._getCopyPublisherConfig(); - // This is temporary until we get a sharing type selector - config.videoSource = "window"; + config.videoSource = actionData.type; this.screenshare = this.sdk.initPublisher(this.getScreenShareElementFunc(), config); diff --git a/browser/components/loop/content/shared/js/views.js b/browser/components/loop/content/shared/js/views.js index e7d3f1203b64..5eb4658d089d 100644 --- a/browser/components/loop/content/shared/js/views.js +++ b/browser/components/loop/content/shared/js/views.js @@ -102,8 +102,18 @@ loop.shared.views = (function(_, l10n) { } }, + _startScreenShare: function(type) { + this.props.dispatcher.dispatch(new sharedActions.StartScreenShare({ + type: type + })); + }, + + _handleShareTabs: function() { + this._startScreenShare("browser"); + }, + _handleShareWindows: function() { - this.props.dispatcher.dispatch(new sharedActions.StartScreenShare({})); + this._startScreenShare("window"); }, _getTitle: function() { @@ -143,6 +153,9 @@ loop.shared.views = (function(_, l10n) { isActive ? null : React.createElement("span", {className: "chevron"}) ), React.createElement("ul", {ref: "menu", className: dropdownMenuClasses}, + React.createElement("li", {onClick: this._handleShareTabs, className: "disabled"}, + l10n.get("share_tabs_button_title") + ), React.createElement("li", {onClick: this._handleShareWindows}, l10n.get("share_windows_button_title") ) diff --git a/browser/components/loop/content/shared/js/views.jsx b/browser/components/loop/content/shared/js/views.jsx index 7bc9b3e419a7..e193f4792bf2 100644 --- a/browser/components/loop/content/shared/js/views.jsx +++ b/browser/components/loop/content/shared/js/views.jsx @@ -102,8 +102,18 @@ loop.shared.views = (function(_, l10n) { } }, + _startScreenShare: function(type) { + this.props.dispatcher.dispatch(new sharedActions.StartScreenShare({ + type: type + })); + }, + + _handleShareTabs: function() { + this._startScreenShare("browser"); + }, + _handleShareWindows: function() { - this.props.dispatcher.dispatch(new sharedActions.StartScreenShare({})); + this._startScreenShare("window"); }, _getTitle: function() { @@ -143,6 +153,9 @@ loop.shared.views = (function(_, l10n) { {isActive ? null : }