Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: remoting/webapp/remoting.js

Issue 15017006: Move test for enabling/disabling It2Me Share button (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/webapp/main.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @type {remoting.HostSession} */ remoting.hostSession = null; 10 /** @type {remoting.HostSession} */ remoting.hostSession = null;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 * @param {string} email The user's email address. 118 * @param {string} email The user's email address.
119 * @return {void} Nothing. 119 * @return {void} Nothing.
120 */ 120 */
121 remoting.onEmail = function(email) { 121 remoting.onEmail = function(email) {
122 document.getElementById('current-email').innerText = email; 122 document.getElementById('current-email').innerText = email;
123 document.getElementById('get-started-it2me').disabled = false; 123 document.getElementById('get-started-it2me').disabled = false;
124 document.getElementById('get-started-me2me').disabled = false; 124 document.getElementById('get-started-me2me').disabled = false;
125 }; 125 };
126 126
127 /** 127 /**
128 * Returns whether or not IT2Me is supported via the host NPAPI plugin.
129 *
130 * @return {boolean}
131 */
132 function isIT2MeSupported_() {
133 var container = document.getElementById('host-plugin-container');
134 /** @type {remoting.HostPlugin} */
135 var plugin = remoting.HostSession.createPlugin();
136 container.appendChild(plugin);
137 var result = plugin.hasOwnProperty('REQUESTED_ACCESS_CODE');
138 container.removeChild(plugin);
139 return result;
140 }
141
142 /**
128 * initHomeScreenUi is called if the app is not starting up in session mode, 143 * initHomeScreenUi is called if the app is not starting up in session mode,
129 * and also if the user cancels pin entry or the connection in session mode. 144 * and also if the user cancels pin entry or the connection in session mode.
130 */ 145 */
131 remoting.initHomeScreenUi = function() { 146 remoting.initHomeScreenUi = function() {
132 remoting.hostController = new remoting.HostController(); 147 remoting.hostController = new remoting.HostController();
133 document.getElementById('share-button').disabled = 148 document.getElementById('share-button').disabled = !isIT2MeSupported_();
134 !remoting.hostController.isPluginSupported();
135 remoting.setMode(remoting.AppMode.HOME); 149 remoting.setMode(remoting.AppMode.HOME);
136 if (!remoting.oauth2.isAuthenticated()) { 150 if (!remoting.oauth2.isAuthenticated()) {
137 document.getElementById('auth-dialog').hidden = false; 151 document.getElementById('auth-dialog').hidden = false;
138 } 152 }
139 remoting.hostSetupDialog = 153 remoting.hostSetupDialog =
140 new remoting.HostSetupDialog(remoting.hostController); 154 new remoting.HostSetupDialog(remoting.hostController);
141 // Display the cached host list, then asynchronously update and re-display it. 155 // Display the cached host list, then asynchronously update and re-display it.
142 remoting.updateLocalHostState(); 156 remoting.updateLocalHostState();
143 remoting.hostList.refresh(remoting.updateLocalHostState); 157 remoting.hostList.refresh(remoting.updateLocalHostState);
144 remoting.initSurvey(); 158 remoting.initSurvey();
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 /** 400 /**
387 * Generate a nonce, to be used as an xsrf protection token. 401 * Generate a nonce, to be used as an xsrf protection token.
388 * 402 *
389 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */ 403 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */
390 remoting.generateXsrfToken = function() { 404 remoting.generateXsrfToken = function() {
391 var random = new Uint8Array(16); 405 var random = new Uint8Array(16);
392 window.crypto.getRandomValues(random); 406 window.crypto.getRandomValues(random);
393 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); 407 var base64Token = window.btoa(String.fromCharCode.apply(null, random));
394 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); 408 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
395 }; 409 };
OLDNEW
« no previous file with comments | « remoting/webapp/main.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698