| OLD | NEW |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 /** | 143 /** |
| 144 * Returns whether or not IT2Me is supported via the host NPAPI plugin. | 144 * Returns whether or not IT2Me is supported via the host NPAPI plugin. |
| 145 * | 145 * |
| 146 * @return {boolean} | 146 * @return {boolean} |
| 147 */ | 147 */ |
| 148 function isIT2MeSupported_() { | 148 function isIT2MeSupported_() { |
| 149 // Currently, IT2Me on Chromebooks is not supported. | 149 // Currently, IT2Me on Chromebooks is not supported. |
| 150 return !remoting.runningOnChromeOS(); | 150 return !remoting.runningOnChromeOS(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // TODO(sergeyu): We want to show Me2Me host controls only on some Linux |
| 154 // distributions that we know work properly with the chromoting host. Implement |
| 155 // dome detection mechanism and apply it here. |
| 156 /** @type {boolean} */ |
| 157 remoting.supportedLinuxDistibutionDetected_ = false; |
| 158 |
| 159 /** |
| 160 * @return {boolean} |
| 161 */ |
| 162 remoting.isMe2MeSupported = function isMe2MeSupported() { |
| 163 /** @type {string} */ |
| 164 var platform = navigator.platform; |
| 165 |
| 166 // Currently Me2Me is supported on Windows, OSX and some versions of Linux. |
| 167 return platform == 'Win32' || platform == 'MacIntel' || |
| 168 ((platform == 'Linux x86_64' || platform == 'Linux i386') && |
| 169 remoting.supportedLinuxDistibutionDetected_ && |
| 170 !remoting.runningOnChromeOS()); |
| 171 } |
| 172 |
| 153 /** | 173 /** |
| 154 * Display the user's email address and allow access to the rest of the app, | 174 * Display the user's email address and allow access to the rest of the app, |
| 155 * including parsing URL parameters. | 175 * including parsing URL parameters. |
| 156 * | 176 * |
| 157 * @param {string} email The user's email address. | 177 * @param {string} email The user's email address. |
| 158 * @return {void} Nothing. | 178 * @return {void} Nothing. |
| 159 */ | 179 */ |
| 160 remoting.onEmail = function(email) { | 180 remoting.onEmail = function(email) { |
| 161 document.getElementById('current-email').innerText = email; | 181 document.getElementById('current-email').innerText = email; |
| 162 document.getElementById('get-started-it2me').disabled = false; | 182 document.getElementById('get-started-it2me').disabled = false; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 /** | 476 /** |
| 457 * Generate a nonce, to be used as an xsrf protection token. | 477 * Generate a nonce, to be used as an xsrf protection token. |
| 458 * | 478 * |
| 459 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */ | 479 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */ |
| 460 remoting.generateXsrfToken = function() { | 480 remoting.generateXsrfToken = function() { |
| 461 var random = new Uint8Array(16); | 481 var random = new Uint8Array(16); |
| 462 window.crypto.getRandomValues(random); | 482 window.crypto.getRandomValues(random); |
| 463 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); | 483 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); |
| 464 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); | 484 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); |
| 465 }; | 485 }; |
| OLD | NEW |