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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 } | 134 } |
135 | 135 |
136 var onLoad = function() { | 136 var onLoad = function() { |
137 // Parse URL parameters. | 137 // Parse URL parameters. |
138 var urlParams = getUrlParameters_(); | 138 var urlParams = getUrlParameters_(); |
139 if ('mode' in urlParams) { | 139 if ('mode' in urlParams) { |
140 if (urlParams['mode'] == 'me2me') { | 140 if (urlParams['mode'] == 'me2me') { |
141 var hostId = urlParams['hostId']; | 141 var hostId = urlParams['hostId']; |
142 remoting.connectMe2Me(hostId); | 142 remoting.connectMe2Me(hostId); |
143 return; | 143 return; |
144 } else if (urlParams['mode'] == 'hrd') { | |
145 var accessCode = urlParams['accessCode']; | |
146 remoting.ensureSessionConnector_(); | |
147 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | |
148 remoting.connector.connectIT2Me(accessCode); | |
149 | |
150 document.body.classList.add('hrd'); | |
151 var HRDHelperSession = new remoting.HRDHelperSession(); | |
152 HRDHelperSession.init(); | |
153 return; | |
144 } | 154 } |
145 } | 155 } |
146 // No valid URL parameters, start up normally. | 156 // No valid URL parameters, start up normally. |
147 remoting.initHomeScreenUi(); | 157 remoting.initHomeScreenUi(); |
148 } | 158 } |
149 remoting.hostList.load(onLoad); | 159 remoting.hostList.load(onLoad); |
150 | 160 |
151 // For Apps v1, check the tab type to warn the user if they are not getting | 161 // For Apps v1, check the tab type to warn the user if they are not getting |
152 // the best keyboard experience. | 162 // the best keyboard experience. |
153 if (!remoting.isAppsV2 && !remoting.platformIsMac()) { | 163 if (!remoting.isAppsV2 && !remoting.platformIsMac()) { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 remoting.generateXsrfToken = function() { | 532 remoting.generateXsrfToken = function() { |
523 var random = new Uint8Array(16); | 533 var random = new Uint8Array(16); |
524 window.crypto.getRandomValues(random); | 534 window.crypto.getRandomValues(random); |
525 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); | 535 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); |
526 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); | 536 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); |
527 }; | 537 }; |
528 | 538 |
529 /** | 539 /** |
530 * Tests whether we are running on Mac. | 540 * Tests whether we are running on Mac. |
531 * | 541 * |
532 * @return {bool} True if the platform is Mac. | 542 * @return {boolean} True if the platform is Mac. |
kelvinp
2014/08/05 01:31:20
Applying Jamie's change to fix jscompile locally t
Jamie
2014/08/05 21:15:14
This has now landed on trunk, so you'll need to re
| |
533 */ | 543 */ |
534 remoting.platformIsMac = function() { | 544 remoting.platformIsMac = function() { |
535 return navigator.platform.indexOf('Mac') != -1; | 545 return navigator.platform.indexOf('Mac') != -1; |
536 } | 546 } |
537 | 547 |
538 /** | 548 /** |
539 * Tests whether we are running on Windows. | 549 * Tests whether we are running on Windows. |
540 * | 550 * |
541 * @return {bool} True if the platform is Windows. | 551 * @return {boolean} True if the platform is Windows. |
542 */ | 552 */ |
543 remoting.platformIsWindows = function() { | 553 remoting.platformIsWindows = function() { |
544 return navigator.platform.indexOf('Win32') != -1; | 554 return navigator.platform.indexOf('Win32') != -1; |
545 } | 555 } |
546 | 556 |
547 /** | 557 /** |
548 * Tests whether we are running on Linux. | 558 * Tests whether we are running on Linux. |
549 * | 559 * |
550 * @return {bool} True if the platform is Linux. | 560 * @return {boolean} True if the platform is Linux. |
551 */ | 561 */ |
552 remoting.platformIsLinux = function() { | 562 remoting.platformIsLinux = function() { |
553 return (navigator.platform.indexOf('Linux') != -1) && | 563 return (navigator.platform.indexOf('Linux') != -1) && |
554 !remoting.platformIsChromeOS(); | 564 !remoting.platformIsChromeOS(); |
555 } | 565 } |
556 | 566 |
557 /** | 567 /** |
558 * Tests whether we are running on ChromeOS. | 568 * Tests whether we are running on ChromeOS. |
559 * | 569 * |
560 * @return {bool} True if the platform is ChromeOS. | 570 * @return {boolean} True if the platform is ChromeOS. |
561 */ | 571 */ |
562 remoting.platformIsChromeOS = function() { | 572 remoting.platformIsChromeOS = function() { |
563 return navigator.userAgent.match(/\bCrOS\b/); | 573 return navigator.userAgent.match(/\bCrOS\b/) != null; |
564 } | 574 } |
OLD | NEW |