| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 url: that.runApplicationUrl(), | 174 url: that.runApplicationUrl(), |
| 175 onDone: parseAppHostResponse, | 175 onDone: parseAppHostResponse, |
| 176 oauthToken: token | 176 oauthToken: token |
| 177 }); | 177 }); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 /** | 180 /** |
| 181 * Report an authentication error to the user. This is called in lieu of start() | 181 * Report an authentication error to the user. This is called in lieu of start() |
| 182 * if the user cannot be authenticated or if they decline the app permissions. | 182 * if the user cannot be authenticated or if they decline the app permissions. |
| 183 * | 183 * |
| 184 * @param {remoting.Error} error The failure reason. | 184 * @param {!remoting.Error} error The failure reason. |
| 185 */ | 185 */ |
| 186 remoting.AppRemoting.prototype.signInFailed = function(error) { | 186 remoting.AppRemoting.prototype.signInFailed = function(error) { |
| 187 if (error == remoting.Error.CANCELLED) { | 187 if (error.tag == remoting.Error.Tag.CANCELLED) { |
| 188 chrome.app.window.current().close(); | 188 chrome.app.window.current().close(); |
| 189 remoting.LoadingWindow.close(); | 189 remoting.LoadingWindow.close(); |
| 190 } else { | 190 } else { |
| 191 this.handleError(error); | 191 this.handleError(error); |
| 192 } | 192 } |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 /** | 195 /** |
| 196 * @return {string} Application product name to be used in UI. | 196 * @return {string} Application product name to be used in UI. |
| 197 */ | 197 */ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 // Cancel the ping when the connection closes. | 250 // Cancel the ping when the connection closes. |
| 251 window.clearInterval(this.pingTimerId_); | 251 window.clearInterval(this.pingTimerId_); |
| 252 | 252 |
| 253 chrome.app.window.current().close(); | 253 chrome.app.window.current().close(); |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * Called when the current session's connection has failed. | 257 * Called when the current session's connection has failed. |
| 258 * | 258 * |
| 259 * @param {remoting.SessionConnector} connector | 259 * @param {remoting.SessionConnector} connector |
| 260 * @param {remoting.Error} error | 260 * @param {!remoting.Error} error |
| 261 * @return {void} Nothing. | 261 * @return {void} Nothing. |
| 262 */ | 262 */ |
| 263 remoting.AppRemoting.prototype.handleConnectionFailed = function( | 263 remoting.AppRemoting.prototype.handleConnectionFailed = function( |
| 264 connector, error) { | 264 connector, error) { |
| 265 this.handleError(error); | 265 this.handleError(error); |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 /** | 268 /** |
| 269 * Called when the current session has reached the point where the host has | 269 * Called when the current session has reached the point where the host has |
| 270 * started streaming video frames to the client. | 270 * started streaming video frames to the client. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 this.contextMenu_.updateConnectionRTT(now - then); | 326 this.contextMenu_.updateConnectionRTT(now - then); |
| 327 return true; | 327 return true; |
| 328 } | 328 } |
| 329 | 329 |
| 330 return false; | 330 return false; |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 /** | 333 /** |
| 334 * Called when an error needs to be displayed to the user. | 334 * Called when an error needs to be displayed to the user. |
| 335 * | 335 * |
| 336 * @param {remoting.Error} errorTag The error to be localized and displayed. | 336 * @param {!remoting.Error} errorTag The error to be localized and displayed. |
| 337 * @return {void} Nothing. | 337 * @return {void} Nothing. |
| 338 */ | 338 */ |
| 339 remoting.AppRemoting.prototype.handleError = function(errorTag) { | 339 remoting.AppRemoting.prototype.handleError = function(errorTag) { |
| 340 console.error('Connection failed: ' + errorTag); | 340 console.error('Connection failed: ' + errorTag); |
| 341 remoting.LoadingWindow.close(); | 341 remoting.LoadingWindow.close(); |
| 342 remoting.MessageWindow.showErrorMessage( | 342 remoting.MessageWindow.showErrorMessage( |
| 343 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 343 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| 344 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 344 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
| 345 }; | 345 }; |
| OLD | NEW |