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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 function ping() { | 233 function ping() { |
234 var message = { timestamp: new Date().getTime() }; | 234 var message = { timestamp: new Date().getTime() }; |
235 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); | 235 clientSession.sendClientMessage('pingRequest', JSON.stringify(message)); |
236 }; | 236 }; |
237 ping(); | 237 ping(); |
238 var timerId = window.setInterval(ping, 10 * 1000); | 238 var timerId = window.setInterval(ping, 10 * 1000); |
239 | 239 |
240 // Cancel the ping when the connection closes. | 240 // Cancel the ping when the connection closes. |
241 clientSession.addEventListener( | 241 clientSession.addEventListener( |
242 remoting.ClientSession.Events.stateChanged, | 242 remoting.ClientSession.Events.stateChanged, |
243 /** @param {remoting.ClientSession.StateEvent} state */ | 243 /** @param {remoting.ClientSession.StateEvent=} state */ |
244 function(state) { | 244 function(state) { |
245 if (state.current === remoting.ClientSession.State.CLOSED || | 245 if (state.current === remoting.ClientSession.State.CLOSED || |
246 state.current === remoting.ClientSession.State.FAILED) { | 246 state.current === remoting.ClientSession.State.FAILED) { |
247 window.clearInterval(timerId); | 247 window.clearInterval(timerId); |
248 } | 248 } |
249 }); | 249 }); |
250 }; | 250 }; |
251 | 251 |
252 /** | 252 /** |
253 * Called when the current session has been disconnected. | 253 * Called when the current session has been disconnected. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 remoting.MessageWindow.showErrorMessage( | 347 remoting.MessageWindow.showErrorMessage( |
348 chrome.i18n.getMessage(/**i18n-content*/'CONNECTION_FAILED'), | 348 chrome.i18n.getMessage(/**i18n-content*/'CONNECTION_FAILED'), |
349 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 349 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
350 }; | 350 }; |
351 | 351 |
352 /** @return {string} */ | 352 /** @return {string} */ |
353 remoting.AppRemoting.prototype.runApplicationUrl = function() { | 353 remoting.AppRemoting.prototype.runApplicationUrl = function() { |
354 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + | 354 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + |
355 remoting.settings.getAppRemotingApplicationId() + '/run'; | 355 remoting.settings.getAppRemotingApplicationId() + '/run'; |
356 }; | 356 }; |
OLD | NEW |