Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: remoting/webapp/crd/js/activation_handler.js

Issue 1370283004: [Chromoting] Remote Assistance in Public Session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PublicSession
Patch Set: Fix GN build Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 /** @suppress {duplicate} */ 5 /** @suppress {duplicate} */
6 var remoting = remoting || {}; 6 var remoting = remoting || {};
7 7
8 (function(){ 8 (function(){
9 9
10 'use strict'; 10 'use strict';
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 remoting.ActivationHandler.prototype.onLaunched_ = function() { 100 remoting.ActivationHandler.prototype.onLaunched_ = function() {
101 this.createWindow_(); 101 this.createWindow_();
102 }; 102 };
103 103
104 /** 104 /**
105 * Create a new app window and register for the closed event. 105 * Create a new app window and register for the closed event.
106 * 106 *
107 * @private 107 * @private
108 */ 108 */
109 remoting.ActivationHandler.prototype.createWindow_ = function() { 109 remoting.ActivationHandler.prototype.createWindow_ = function() {
110 this.appLauncher_.launch().then(this.onWindowCreated_.bind(this)); 110 var that = this;
111 return this.isPublicSession_().then(
112 this.launchPublicSession_.bind(this)
113 ).catch(function() {
114 that.appLauncher_.launch().then(that.onWindowCreated_.bind(that));
115 });
111 }; 116 };
112 117
113 /** 118 /**
114 * @param {string} windowId 119 * @param {string} windowId
115 * 120 *
116 * @private 121 * @private
117 */ 122 */
118 remoting.ActivationHandler.prototype.onWindowCreated_ = function( 123 remoting.ActivationHandler.prototype.onWindowCreated_ = function(
119 windowId) { 124 windowId) {
120 // Send the client heartbeat. 125 // Send the client heartbeat.
(...skipping 16 matching lines...) Expand all
137 */ 142 */
138 remoting.ActivationHandler.prototype.onWindowClosed_ = function(id) { 143 remoting.ActivationHandler.prototype.onWindowClosed_ = function(id) {
139 // Unhook the event. 144 // Unhook the event.
140 var hook = /** @type {base.Disposable} */ (this.windowClosedHooks_.get(id)); 145 var hook = /** @type {base.Disposable} */ (this.windowClosedHooks_.get(id));
141 base.dispose(hook); 146 base.dispose(hook);
142 this.windowClosedHooks_.delete(id); 147 this.windowClosedHooks_.delete(id);
143 148
144 this.raiseEvent(remoting.ActivationHandler.Events.windowClosed, id); 149 this.raiseEvent(remoting.ActivationHandler.Events.windowClosed, id);
145 }; 150 };
146 151
152 /**
153 * @return {Promise} A Promise that resolves if this is a public session or
154 * rejects if it is not.
155 * @private
156 */
157 remoting.ActivationHandler.prototype.isPublicSession_ = function() {
158 // Check whether this is a service account to determine whether we are
159 // currently signed-in as a public session or not.
160 return remoting.identity.getEmail().then(function(/** string */ email) {
161 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.
162 return Promise.reject();
163 }
164 });
165 };
166
167 /** @private */
168 remoting.ActivationHandler.prototype.launchPublicSession_ = function() {
169 chrome.app.window.create("public_session.html", {
170 'width': 570,
171 '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
172 'resizable': false
173 });
174 };
175
147 })(); 176 })();
148 177
149 /** @enum {string} */ 178 /** @enum {string} */
150 remoting.ActivationHandler.Events = { 179 remoting.ActivationHandler.Events = {
151 windowClosed: 'windowClosed' 180 windowClosed: 'windowClosed'
152 }; 181 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698