| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 this.handleError(error); |
| 188 chrome.app.window.current().close(); | |
| 189 remoting.LoadingWindow.close(); | |
| 190 } else { | |
| 191 this.handleError(error); | |
| 192 } | |
| 193 }; | 188 }; |
| 194 | 189 |
| 195 /** | 190 /** |
| 196 * @return {string} Application product name to be used in UI. | 191 * @return {string} Application product name to be used in UI. |
| 197 */ | 192 */ |
| 198 remoting.AppRemoting.prototype.getApplicationName = function() { | 193 remoting.AppRemoting.prototype.getApplicationName = function() { |
| 199 var manifest = chrome.runtime.getManifest(); | 194 var manifest = chrome.runtime.getManifest(); |
| 200 return manifest.name; | 195 return manifest.name; |
| 201 }; | 196 }; |
| 202 | 197 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 * @param {remoting.Error} errorTag The error to be localized and displayed. | 331 * @param {remoting.Error} errorTag The error to be localized and displayed. |
| 337 * @return {void} Nothing. | 332 * @return {void} Nothing. |
| 338 */ | 333 */ |
| 339 remoting.AppRemoting.prototype.handleError = function(errorTag) { | 334 remoting.AppRemoting.prototype.handleError = function(errorTag) { |
| 340 console.error('Connection failed: ' + errorTag); | 335 console.error('Connection failed: ' + errorTag); |
| 341 remoting.LoadingWindow.close(); | 336 remoting.LoadingWindow.close(); |
| 342 remoting.MessageWindow.showErrorMessage( | 337 remoting.MessageWindow.showErrorMessage( |
| 343 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 338 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| 344 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 339 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
| 345 }; | 340 }; |
| 341 |
| 342 /** |
| 343 * Close the loading window before exiting. |
| 344 */ |
| 345 remoting.AppRemoting.prototype.handleExit = function() { |
| 346 remoting.LoadingWindow.close(); |
| 347 }; |
| OLD | NEW |