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 /** @constructor */ | 10 /** @constructor */ |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 */ | 123 */ |
124 remoting.HostController.prototype.start = function(hostPin, consent, onDone, | 124 remoting.HostController.prototype.start = function(hostPin, consent, onDone, |
125 onError) { | 125 onError) { |
126 /** @type {remoting.HostController} */ | 126 /** @type {remoting.HostController} */ |
127 var that = this; | 127 var that = this; |
128 | 128 |
129 /** @return {string} */ | 129 /** @return {string} */ |
130 function generateUuid() { | 130 function generateUuid() { |
131 var random = new Uint16Array(8); | 131 var random = new Uint16Array(8); |
132 window.crypto.getRandomValues(random); | 132 window.crypto.getRandomValues(random); |
133 /** @type {Array.<string>} */ | 133 /** @type {Array<string>} */ |
134 var e = new Array(); | 134 var e = new Array(); |
135 for (var i = 0; i < 8; i++) { | 135 for (var i = 0; i < 8; i++) { |
136 e[i] = (/** @type {number} */ (random[i]) + 0x10000). | 136 e[i] = (/** @type {number} */ (random[i]) + 0x10000). |
137 toString(16).substring(1); | 137 toString(16).substring(1); |
138 } | 138 } |
139 return e[0] + e[1] + '-' + e[2] + '-' + e[3] + '-' + | 139 return e[0] + e[1] + '-' + e[2] + '-' + e[3] + '-' + |
140 e[4] + '-' + e[5] + e[6] + e[7]; | 140 e[4] + '-' + e[5] + e[6] + e[7]; |
141 }; | 141 }; |
142 | 142 |
143 var newHostId = generateUuid(); | 143 var newHostId = generateUuid(); |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 }; | 480 }; |
481 | 481 |
482 this.hostDaemonFacade_.getDaemonConfig(onConfig, function(error) { | 482 this.hostDaemonFacade_.getDaemonConfig(onConfig, function(error) { |
483 onDone(null); | 483 onDone(null); |
484 }); | 484 }); |
485 }; | 485 }; |
486 | 486 |
487 /** | 487 /** |
488 * Fetch the list of paired clients for this host. | 488 * Fetch the list of paired clients for this host. |
489 * | 489 * |
490 * @param {function(Array.<remoting.PairedClient>):void} onDone | 490 * @param {function(Array<remoting.PairedClient>):void} onDone |
491 * @param {function(remoting.Error):void} onError | 491 * @param {function(remoting.Error):void} onError |
492 * @return {void} | 492 * @return {void} |
493 */ | 493 */ |
494 remoting.HostController.prototype.getPairedClients = function(onDone, | 494 remoting.HostController.prototype.getPairedClients = function(onDone, |
495 onError) { | 495 onError) { |
496 this.hostDaemonFacade_.getPairedClients(onDone, onError); | 496 this.hostDaemonFacade_.getPairedClients(onDone, onError); |
497 }; | 497 }; |
498 | 498 |
499 /** | 499 /** |
500 * Delete a single paired client. | 500 * Delete a single paired client. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 function connectSignalingWithTokenAndEmail(token, email) { | 570 function connectSignalingWithTokenAndEmail(token, email) { |
571 signalStrategy.connect( | 571 signalStrategy.connect( |
572 remoting.settings.XMPP_SERVER_FOR_CLIENT, email, token); | 572 remoting.settings.XMPP_SERVER_FOR_CLIENT, email, token); |
573 } | 573 } |
574 | 574 |
575 remoting.identity.callWithToken(connectSignalingWithToken, onError); | 575 remoting.identity.callWithToken(connectSignalingWithToken, onError); |
576 }; | 576 }; |
577 | 577 |
578 /** @type {remoting.HostController} */ | 578 /** @type {remoting.HostController} */ |
579 remoting.hostController = null; | 579 remoting.hostController = null; |
OLD | NEW |