Chromium Code Reviews| 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 /** |
| 191 * Close the loading window before exiting. | |
| 192 */ | |
| 193 remoting.AppRemoting.prototype.stop = function() { | |
|
kelvinp
2015/03/09 17:48:49
Would close or onShutdown be a better name, since
Jamie
2015/03/09 17:58:11
I've gone with handleExit to match the other handl
| |
| 194 remoting.LoadingWindow.close(); | |
| 195 }; | |
| 196 | |
| 197 /** | |
| 196 * @return {string} Application product name to be used in UI. | 198 * @return {string} Application product name to be used in UI. |
| 197 */ | 199 */ |
| 198 remoting.AppRemoting.prototype.getApplicationName = function() { | 200 remoting.AppRemoting.prototype.getApplicationName = function() { |
| 199 var manifest = chrome.runtime.getManifest(); | 201 var manifest = chrome.runtime.getManifest(); |
| 200 return manifest.name; | 202 return manifest.name; |
| 201 }; | 203 }; |
| 202 | 204 |
| 203 /** @return {string} */ | 205 /** @return {string} */ |
| 204 remoting.AppRemoting.prototype.runApplicationUrl = function() { | 206 remoting.AppRemoting.prototype.runApplicationUrl = function() { |
| 205 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + | 207 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 * @param {remoting.Error} errorTag The error to be localized and displayed. | 338 * @param {remoting.Error} errorTag The error to be localized and displayed. |
| 337 * @return {void} Nothing. | 339 * @return {void} Nothing. |
| 338 */ | 340 */ |
| 339 remoting.AppRemoting.prototype.handleError = function(errorTag) { | 341 remoting.AppRemoting.prototype.handleError = function(errorTag) { |
| 340 console.error('Connection failed: ' + errorTag); | 342 console.error('Connection failed: ' + errorTag); |
| 341 remoting.LoadingWindow.close(); | 343 remoting.LoadingWindow.close(); |
| 342 remoting.MessageWindow.showErrorMessage( | 344 remoting.MessageWindow.showErrorMessage( |
| 343 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 345 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| 344 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); | 346 chrome.i18n.getMessage(/** @type {string} */ (errorTag))); |
| 345 }; | 347 }; |
| OLD | NEW |