Chromium Code Reviews| Index: remoting/webapp/crd/js/activation_handler.js |
| diff --git a/remoting/webapp/crd/js/activation_handler.js b/remoting/webapp/crd/js/activation_handler.js |
| index 901dde9f7562545b064557fbd1b249763b31bf8e..caa30b19c229a4935ed8aa74572289f2ab0a9a38 100644 |
| --- a/remoting/webapp/crd/js/activation_handler.js |
| +++ b/remoting/webapp/crd/js/activation_handler.js |
| @@ -107,7 +107,12 @@ remoting.ActivationHandler.prototype.onLaunched_ = function() { |
| * @private |
| */ |
| remoting.ActivationHandler.prototype.createWindow_ = function() { |
| - this.appLauncher_.launch().then(this.onWindowCreated_.bind(this)); |
| + var that = this; |
| + return this.isPublicSession_().then( |
| + this.launchPublicSession_.bind(this) |
| + ).catch(function() { |
| + that.appLauncher_.launch().then(that.onWindowCreated_.bind(that)); |
| + }); |
| }; |
| /** |
| @@ -144,6 +149,30 @@ remoting.ActivationHandler.prototype.onWindowClosed_ = function(id) { |
| this.raiseEvent(remoting.ActivationHandler.Events.windowClosed, id); |
| }; |
| +/** |
| + * @return {Promise} A Promise that resolves if this is a public session or |
| + * rejects if it is not. |
| + * @private |
| + */ |
| +remoting.ActivationHandler.prototype.isPublicSession_ = function() { |
| + // Check whether this is a service account to determine whether we are |
| + // currently signed-in as a public session or not. |
| + return remoting.identity.getEmail().then(function(/** string */ email) { |
| + if (email.indexOf('@gserviceaccount.com') == -1) { |
|
Jamie
2015/09/30 17:46:13
Please add a TODO to clean this up once we have an
kelvinp
2015/09/30 19:35:47
Fixed to use the actual flag instead.
|
| + return Promise.reject(); |
| + } |
| + }); |
| +}; |
| + |
| +/** @private */ |
| +remoting.ActivationHandler.prototype.launchPublicSession_ = function() { |
| + chrome.app.window.create("public_session.html", { |
| + 'width': 570, |
| + 'height': 300, |
|
Jamie
2015/09/30 17:46:13
In general, you can't hard-code a height because i
kelvinp
2015/09/30 19:35:47
Fixed in public_session_main.js
|
| + 'resizable': false |
| + }); |
| +}; |
| + |
| })(); |
| /** @enum {string} */ |