| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * This class implements the functionality that is specific to application | 7 * This class implements the functionality that is specific to application |
| 8 * remoting ("AppRemoting" or AR). | 8 * remoting ("AppRemoting" or AR). |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return ''; | 231 return ''; |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 /** | 234 /** |
| 235 * Called when a new session has been connected. | 235 * Called when a new session has been connected. |
| 236 * | 236 * |
| 237 * @param {remoting.ClientSession} clientSession | 237 * @param {remoting.ClientSession} clientSession |
| 238 * @return {void} Nothing. | 238 * @return {void} Nothing. |
| 239 */ | 239 */ |
| 240 remoting.AppRemoting.prototype.handleConnected = function(clientSession) { | 240 remoting.AppRemoting.prototype.handleConnected = function(clientSession) { |
| 241 remoting.clientSession.sendClientMessage( | 241 remoting.identity.getUserInfo().then( |
| 242 'setUserDisplayInfo', | 242 function(userInfo) { |
| 243 JSON.stringify({fullName: remoting.identity.getCachedUserFullName()})); | 243 remoting.clientSession.sendClientMessage( |
| 244 'setUserDisplayInfo', |
| 245 JSON.stringify({fullName: userInfo.name})); |
| 246 }); |
| 244 | 247 |
| 245 // Set up a ping at 10-second intervals to test the connection speed. | 248 // Set up a ping at 10-second intervals to test the connection speed. |
| 246 function ping() { | 249 function ping() { |
| 247 var message = { timestamp: new Date().getTime() }; | 250 var message = { timestamp: new Date().getTime() }; |
| 248 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); | 251 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); |
| 249 }; | 252 }; |
| 250 ping(); | 253 ping(); |
| 251 this.pingTimerId_ = window.setInterval(ping, 10 * 1000); | 254 this.pingTimerId_ = window.setInterval(ping, 10 * 1000); |
| 252 }; | 255 }; |
| 253 | 256 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 * @param {remoting.Error} errorTag The error to be localized and displayed. | 349 * @param {remoting.Error} errorTag The error to be localized and displayed. |
| 347 * @return {void} Nothing. | 350 * @return {void} Nothing. |
| 348 */ | 351 */ |
| 349 remoting.AppRemoting.prototype.handleError = function(errorTag) { | 352 remoting.AppRemoting.prototype.handleError = function(errorTag) { |
| 350 console.error('Connection failed: ' + errorTag); | 353 console.error('Connection failed: ' + errorTag); |
| 351 remoting.LoadingWindow.close(); | 354 remoting.LoadingWindow.close(); |
| 352 remoting.MessageWindow.showErrorMessage( | 355 remoting.MessageWindow.showErrorMessage( |
| 353 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 356 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| 354 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 357 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
| 355 }; | 358 }; |
| OLD | NEW |