Index: remoting/webapp/crd/js/desktop_remoting.js |
diff --git a/remoting/webapp/crd/js/desktop_remoting.js b/remoting/webapp/crd/js/desktop_remoting.js |
index 273ecc5c945cad18afa0633846c691b368f81be7..331ee4cebdf0775b1782b882a981046010fd6ada 100644 |
--- a/remoting/webapp/crd/js/desktop_remoting.js |
+++ b/remoting/webapp/crd/js/desktop_remoting.js |
@@ -41,30 +41,12 @@ remoting.DesktopRemoting = function(app) { |
}; |
/** |
- * Display the user's email address and allow access to the rest of the app, |
- * including parsing URL parameters. |
- * |
- * @param {string} email The user's email address. |
- * @param {string} fullName The user's full name. This is always null since |
- * CRD doesn't request userinfo.profile permission. |
- * @return {void} Nothing. |
- */ |
-remoting.onUserInfoAvailable = function(email, fullName) { |
- document.getElementById('current-email').innerText = email; |
- document.getElementById('get-started-it2me').disabled = false; |
- document.getElementById('get-started-me2me').disabled = false; |
-}; |
- |
-/** |
* Initialize the application and register all event handlers. After this |
* is called, the app is running and waiting for user events. |
* |
* @return {void} Nothing. |
*/ |
remoting.DesktopRemoting.prototype.init = function() { |
- remoting.initGlobalObjects(); |
- remoting.initIdentity(remoting.onUserInfoAvailable); |
- |
remoting.initElementEventHandlers(); |
if (base.isAppsV2()) { |
@@ -143,6 +125,38 @@ remoting.DesktopRemoting.prototype.init = function() { |
} |
/** |
+ * Start the application. Once start() is called, the delegate can assume that |
+ * the user has consented to all permissions specified in the manifest. |
+ * |
+ * @param {remoting.SessionConnector} connector |
+ * @param {string} token An OAuth access token. The delegate should not cache |
+ * this token, but can assume that it will remain valid during application |
+ * start-up. |
+ */ |
+remoting.DesktopRemoting.prototype.start = function(connector, token) { |
+ remoting.identity.getEmail().then( |
+ function(/** string */ email) { |
+ document.getElementById('current-email').innerText = email; |
+ document.getElementById('get-started-it2me').disabled = false; |
+ document.getElementById('get-started-me2me').disabled = false; |
+ }); |
+}; |
+ |
+/** |
+ * Report an authentication error to the user. This is called in lieu of start() |
+ * if the user cannot be authenticated or if they decline the app permissions. |
+ * |
+ * @param {remoting.Error} error The failure reason. |
+ */ |
+remoting.DesktopRemoting.prototype.signInFailed = function(error) { |
+ if (error == remoting.Error.CANCELLED) { |
+ chrome.app.window.current().close(); |
garykac
2015/03/05 02:38:25
if AppsV2?
Jamie
2015/03/05 19:01:36
I'm assuming that there is only apps v2 for this c
garykac
2015/03/06 21:16:25
Acknowledged.
|
+ } else { |
+ remoting.showErrorMessage(error); |
+ } |
+}; |
+ |
+/** |
* @return {string} Application product name to be used in UI. |
*/ |
remoting.DesktopRemoting.prototype.getApplicationName = function() { |