summaryrefslogtreecommitdiffstats
path: root/remoting/webapp
diff options
context:
space:
mode:
authorjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 07:06:39 +0000
committerjamiewalch@chromium.org <jamiewalch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-24 07:06:39 +0000
commit4cc63fc8670f96870f69a6e1b42d28b8763fdaa7 (patch)
treefc1dd94ed6964281fea52cafc98f771aba7cd4c0 /remoting/webapp
parentf20a99a23985538944aa5fafdc645fad9b578635 (diff)
downloadchromium_src-4cc63fc8670f96870f69a6e1b42d28b8763fdaa7.zip
chromium_src-4cc63fc8670f96870f69a6e1b42d28b8763fdaa7.tar.gz
chromium_src-4cc63fc8670f96870f69a6e1b42d28b8763fdaa7.tar.bz2
Show a 'remember me' checkbox in the web-app when connecting to a host that supports pairing.
Currently this checkbox does nothing. The next CL will add code to request pairing if it was checked. BUG=156182 Review URL: https://chromiumcodereview.appspot.com/15685008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202001 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp')
-rw-r--r--remoting/webapp/client_plugin.js2
-rw-r--r--remoting/webapp/client_plugin_async.js17
-rw-r--r--remoting/webapp/client_screen.js12
-rw-r--r--remoting/webapp/client_session.js15
-rw-r--r--remoting/webapp/main.css1
-rw-r--r--remoting/webapp/main.html56
-rw-r--r--remoting/webapp/session_connector.js7
7 files changed, 70 insertions, 40 deletions
diff --git a/remoting/webapp/client_plugin.js b/remoting/webapp/client_plugin.js
index 6c5eff4..2b28336 100644
--- a/remoting/webapp/client_plugin.js
+++ b/remoting/webapp/client_plugin.js
@@ -33,7 +33,7 @@ remoting.ClientPlugin.prototype.onConnectionReadyHandler;
remoting.ClientPlugin.prototype.onDesktopSizeUpdateHandler;
/** @type {function(!Array.<string>): void} Capabilities negotiated callback. */
remoting.ClientPlugin.prototype.onSetCapabilitiesHandler;
-/** @type {function(): void} Request a PIN from the user. */
+/** @type {function(boolean): void} Request a PIN from the user. */
remoting.ClientPlugin.prototype.fetchPinHandler;
/**
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index 788b49a..cb64329 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -50,7 +50,7 @@ remoting.ClientPluginAsync = function(plugin) {
this.onDesktopSizeUpdateHandler = function () {};
/** @param {!Array.<string>} capabilities The negotiated capabilities. */
this.onSetCapabilitiesHandler = function (capabilities) {};
- this.fetchPinHandler = function () {};
+ this.fetchPinHandler = function (supportsPairing) {};
/** @type {number} */
this.pluginApiVersion_ = -1;
@@ -263,7 +263,20 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
var ready = /** @type {boolean} */ message.data['ready'];
this.onConnectionReadyHandler(ready);
} else if (message.method == 'fetchPin') {
- this.fetchPinHandler();
+ // The pairingSupported value in the dictionary indicates whether both
+ // client and host support pairing. If the client doesn't support pairing,
+ // then the value won't be there at all, so give it a default of false.
+ /** @type {boolean} */
+ var pairingSupported = false;
+ if ('pairingSupported' in message.data) {
+ pairingSupported =
+ /** @type {boolean} */ message.data['pairingSupported'];
+ if (typeof pairingSupported != 'boolean') {
+ console.error('Received incorrect fetchPin message.');
+ return;
+ }
+ }
+ this.fetchPinHandler(pairingSupported);
} else if (message.method == 'setCapabilities') {
if (typeof message.data['capabilities'] != 'string') {
console.error('Received incorrect setCapabilities message.');
diff --git a/remoting/webapp/client_screen.js b/remoting/webapp/client_screen.js
index ffd745c..feaf29d 100644
--- a/remoting/webapp/client_screen.js
+++ b/remoting/webapp/client_screen.js
@@ -265,8 +265,11 @@ remoting.connectMe2MeHostVersionAcknowledged_ = function(host) {
thirdPartyTokenFetcher.fetchToken();
};
- /** @param {function(string):void} onPinFetched */
- var requestPin = function(onPinFetched) {
+ /**
+ * @param {boolean} supportsPairing
+ * @param {function(string):void} onPinFetched
+ */
+ var requestPin = function(supportsPairing, onPinFetched) {
/** @type {Element} */
var pinForm = document.getElementById('pin-form');
/** @type {Element} */
@@ -296,6 +299,11 @@ remoting.connectMe2MeHostVersionAcknowledged_ = function(host) {
pinForm.addEventListener('submit', onSubmitOrCancel, false);
pinCancel.addEventListener('click', onSubmitOrCancel, false);
+ var rememberPin = document.getElementById('remember-pin');
+ rememberPin.hidden = !supportsPairing;
+ var checkbox = /** @type {HTMLInputElement} */
+ document.getElementById('remember-pin-checkbox');
+ checkbox.checked = false;
var message = document.getElementById('pin-message');
l10n.localizeElement(message, host.hostName);
remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT);
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
index f75bdcf..f40fa85 100644
--- a/remoting/webapp/client_session.js
+++ b/remoting/webapp/client_session.js
@@ -28,8 +28,9 @@ var remoting = remoting || {};
* @param {string} hostPublicKey The base64 encoded version of the host's
* public key.
* @param {string} accessCode The IT2Me access code. Blank for Me2Me.
- * @param {function(function(string): void): void} fetchPin Called by Me2Me
- * connections when a PIN needs to be obtained interactively.
+ * @param {function(boolean, function(string): void): void} fetchPin
+ * Called by Me2Me connections when a PIN needs to be obtained
+ * interactively.
* @param {function(string, string, string,
* function(string, string): void): void}
* fetchThirdPartyToken Called by Me2Me connections when a third party
@@ -745,14 +746,16 @@ remoting.ClientSession.prototype.connectPluginToWcs_ = function() {
remoting.ClientPlugin.Feature.ASYNC_PIN)) {
// Plugin supports asynchronously asking for the PIN.
plugin.useAsyncPinDialog();
- var fetchPin = function() {
- that.fetchPin_(plugin.onPinFetched.bind(plugin));
+ /** @param {boolean} pairingSupported */
+ var fetchPin = function(pairingSupported) {
+ that.fetchPin_(pairingSupported, plugin.onPinFetched.bind(plugin));
};
plugin.fetchPinHandler = fetchPin;
this.connectToHost_('');
} else {
- // Plugin doesn't support asynchronously asking for the PIN, ask now.
- this.fetchPin_(this.connectToHost_.bind(this));
+ // Clients that don't support asking for a PIN asynchronously also don't
+ // support pairing, so request the PIN now without offering to remember it.
+ this.fetchPin_(false, this.connectToHost_.bind(this));
}
};
diff --git a/remoting/webapp/main.css b/remoting/webapp/main.css
index 5aba440..666e728 100644
--- a/remoting/webapp/main.css
+++ b/remoting/webapp/main.css
@@ -549,6 +549,7 @@ button {
.checkbox-label {
display: block;
padding-__MSG_@@bidi_start_edge__: 20px;
+ margin-top: 12px;
}
.checkbox-label input[type=checkbox] {
diff --git a/remoting/webapp/main.html b/remoting/webapp/main.html
index 341aa5d..89d0ec7 100644
--- a/remoting/webapp/main.html
+++ b/remoting/webapp/main.html
@@ -521,35 +521,39 @@ found in the LICENSE file.
</div>
</div> <!-- home.client.host-needs-upgrade -->
- <div data-ui-mode="home.client.pin-prompt" class="centered">
+ <div data-ui-mode="home.client.pin-prompt">
<div id="pin-message"
i18n-content="PIN_MESSAGE"
class="message"></div>
- <div>
- <form id="pin-form" action="">
- <label for="pin-entry"
- i18n-content="PIN"
- class="editbox-label"></label>
- <input id="pin-entry"
- type="password"
- autofocus="autofocus"
- autocomplete="off"/>
- <button id="connect-button"
- type="submit"
- i18n-content="CONNECT_BUTTON">
- </button>
- <button id="cancel-pin-entry-button"
- type="button"
- i18n-content="CANCEL">
- </button>
- </form>
- <div id="startup-mode-box-me2me" class="information-box" hidden>
- <span i18n-content="WARNING_NOT_WINDOWED"></span>
- <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=1649523"
- target="_blank"
- i18n-content="LEARN_HOW"></a>
- </div> <!-- startup-mode-box-it2me -->
- </div>
+ <form id="pin-form" action="" class="centered">
+ <label for="pin-entry"
+ i18n-content="PIN"
+ class="editbox-label"></label>
+ <input id="pin-entry"
+ type="password"
+ autofocus="autofocus"
+ autocomplete="off"/>
+ <button id="connect-button"
+ type="submit"
+ i18n-content="CONNECT_BUTTON">
+ </button>
+ <button id="cancel-pin-entry-button"
+ type="button"
+ i18n-content="CANCEL">
+ </button>
+ </form>
+ <label id="remember-pin" class="checkbox-label">
+ <input id="remember-pin-checkbox" type="checkbox">
+ <span i18n-content="REMEMBER_PIN"></span>
+ </label>
+ <div id="startup-mode-box-me2me"
+ class="information-box centered"
+ hidden>
+ <span i18n-content="WARNING_NOT_WINDOWED"></span>
+ <a href="http://support.google.com/chrome/bin/answer.py?hl=en&answer=1649523"
+ target="_blank"
+ i18n-content="LEARN_HOW"></a>
+ </div> <!-- startup-mode-box-it2me -->
</div> <!-- client.pin-prompt -->
<div data-ui-mode="home.client.third-party-auth" class="centered">
diff --git a/remoting/webapp/session_connector.js b/remoting/webapp/session_connector.js
index dfe9280..779a00f 100644
--- a/remoting/webapp/session_connector.js
+++ b/remoting/webapp/session_connector.js
@@ -118,7 +118,8 @@ remoting.SessionConnector.prototype.reset = function() {
this.pendingXhr_ = null;
/**
- * @type {function(function(string):void): void}
+ * Function to interactively obtain the PIN from the user.
+ * @type {function(boolean, function(string):void):void}
* @private
*/
this.fetchPin_ = function(onPinFetched) {};
@@ -146,7 +147,7 @@ remoting.SessionConnector.prototype.reset = function() {
* Initiate a Me2Me connection.
*
* @param {remoting.Host} host The Me2Me host to which to connect.
- * @param {function(function(string):void):void} fetchPin Function to
+ * @param {function(boolean, function(string):void):void} fetchPin Function to
* interactively obtain the PIN from the user.
* @param {function(string, string, string,
* function(string, string): void): void}
@@ -313,7 +314,7 @@ remoting.SessionConnector.prototype.createSessionIfReady_ = function() {
return;
}
- var securityTypes = 'third_party,spake2_hmac,spake2_plain';
+ var securityTypes = 'third_party,spake2_pair,spake2_hmac,spake2_plain';
this.clientSession_ = new remoting.ClientSession(
this.hostJid_, this.clientJid_, this.hostPublicKey_, this.passPhrase_,
this.fetchPin_, this.fetchThirdPartyToken_, securityTypes, this.hostId_,