| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 /** @param {string} privateKey | 149 /** @param {string} privateKey |
| 150 * @param {XMLHttpRequest} xhr */ | 150 * @param {XMLHttpRequest} xhr */ |
| 151 function onRegistered(privateKey, xhr) { | 151 function onRegistered(privateKey, xhr) { |
| 152 var success = (xhr.status == 200); | 152 var success = (xhr.status == 200); |
| 153 | 153 |
| 154 if (success) { | 154 if (success) { |
| 155 var hostSecretHash = | 155 var hostSecretHash = |
| 156 'hmac:' + that.plugin_.getPinHash(newHostId, hostPin); | 156 'hmac:' + that.plugin_.getPinHash(newHostId, hostPin); |
| 157 var hostConfig = JSON.stringify({ | 157 var hostConfig = JSON.stringify({ |
| 158 xmpp_login: remoting.oauth2.getCachedEmail(), | 158 xmpp_login: remoting.oauth2.getCachedEmail(), |
| 159 oauth_refresh_token: remoting.oauth2.getRefreshToken(), | 159 oauth_refresh_token: remoting.oauth2.exportRefreshToken(), |
| 160 host_id: newHostId, | 160 host_id: newHostId, |
| 161 host_name: hostName, | 161 host_name: hostName, |
| 162 host_secret_hash: hostSecretHash, | 162 host_secret_hash: hostSecretHash, |
| 163 private_key: privateKey | 163 private_key: privateKey |
| 164 }); | 164 }); |
| 165 /** @param {remoting.HostController.AsyncResult} result */ | 165 /** @param {remoting.HostController.AsyncResult} result */ |
| 166 var onStartDaemon = function(result) { | 166 var onStartDaemon = function(result) { |
| 167 onStarted(callback, result, hostName); | 167 onStarted(callback, result, hostName); |
| 168 }; | 168 }; |
| 169 that.plugin_.startDaemon(hostConfig, onStartDaemon); | 169 that.plugin_.startDaemon(hostConfig, onStartDaemon); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 if (hostId && typeof(hostId) == 'string') { | 308 if (hostId && typeof(hostId) == 'string') { |
| 309 this.setHost(hostList.getHostForId(/** @type{string} */(hostId))); | 309 this.setHost(hostList.getHostForId(/** @type{string} */(hostId))); |
| 310 } else { | 310 } else { |
| 311 this.setHost(null); | 311 this.setHost(null); |
| 312 } | 312 } |
| 313 onDone(); | 313 onDone(); |
| 314 }; | 314 }; |
| 315 | 315 |
| 316 /** @type {remoting.HostController} */ | 316 /** @type {remoting.HostController} */ |
| 317 remoting.hostController = null; | 317 remoting.hostController = null; |
| OLD | NEW |