| 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 remoting.xhr.start({ | 178 remoting.xhr.start({ |
| 179 method: 'POST', | 179 method: 'POST', |
| 180 url: that.runApplicationUrl(), | 180 url: that.runApplicationUrl(), |
| 181 onDone: parseAppHostResponse, | 181 onDone: parseAppHostResponse, |
| 182 oauthToken: token | 182 oauthToken: token |
| 183 }); | 183 }); |
| 184 }; | 184 }; |
| 185 | 185 |
| 186 /** | 186 /** |
| 187 * Report an authentication error to the user. This is called in lieu of start() | |
| 188 * if the user cannot be authenticated or if they decline the app permissions. | |
| 189 * | |
| 190 * @param {!remoting.Error} error The failure reason. | |
| 191 */ | |
| 192 remoting.AppRemoting.prototype.signInFailed = function(error) { | |
| 193 this.handleError(error); | |
| 194 }; | |
| 195 | |
| 196 /** | |
| 197 * @return {string} Application product name to be used in UI. | 187 * @return {string} Application product name to be used in UI. |
| 198 */ | 188 */ |
| 199 remoting.AppRemoting.prototype.getApplicationName = function() { | 189 remoting.AppRemoting.prototype.getApplicationName = function() { |
| 200 var manifest = chrome.runtime.getManifest(); | 190 var manifest = chrome.runtime.getManifest(); |
| 201 return manifest.name; | 191 return manifest.name; |
| 202 }; | 192 }; |
| 203 | 193 |
| 204 /** @return {string} */ | 194 /** @return {string} */ |
| 205 remoting.AppRemoting.prototype.runApplicationUrl = function() { | 195 remoting.AppRemoting.prototype.runApplicationUrl = function() { |
| 206 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + | 196 return remoting.settings.APP_REMOTING_API_BASE_URL + '/applications/' + |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 */ | 342 */ |
| 353 remoting.AppRemoting.prototype.handleError = function(error) { | 343 remoting.AppRemoting.prototype.handleError = function(error) { |
| 354 console.error('Connection failed: ' + error.toString()); | 344 console.error('Connection failed: ' + error.toString()); |
| 355 remoting.LoadingWindow.close(); | 345 remoting.LoadingWindow.close(); |
| 356 remoting.MessageWindow.showErrorMessage( | 346 remoting.MessageWindow.showErrorMessage( |
| 357 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), | 347 chrome.i18n.getMessage(/*i18n-content*/'CONNECTION_FAILED'), |
| 358 chrome.i18n.getMessage(error.getTag())); | 348 chrome.i18n.getMessage(error.getTag())); |
| 359 }; | 349 }; |
| 360 | 350 |
| 361 /** | 351 /** |
| 352 * Report an authentication error to the user. This is called in lieu of start() |
| 353 * if the user cannot be authenticated or if they decline the app permissions. |
| 354 * |
| 355 * @param {!remoting.Error} error The failure reason. |
| 356 */ |
| 357 remoting.AppRemoting.prototype.handleAuthError = function(error) { |
| 358 this.handleError(error); |
| 359 }; |
| 360 |
| 361 /** |
| 362 * Close the loading window before exiting. | 362 * Close the loading window before exiting. |
| 363 */ | 363 */ |
| 364 remoting.AppRemoting.prototype.handleExit = function() { | 364 remoting.AppRemoting.prototype.handleExit = function() { |
| 365 remoting.LoadingWindow.close(); | 365 remoting.LoadingWindow.close(); |
| 366 }; | 366 }; |
| OLD | NEW |