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

Side by Side Diff: chrome/browser/resources/chromeos/login/screen_gaia_signin.js

Issue 995753002: Load webview based GAIA in hidden state and pass focus when ready (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth_host/authenticator.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 Oobe signin screen implementation. 6 * @fileoverview Oobe signin screen implementation.
7 */ 7 */
8 8
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() {
10 // Gaia loading time after which error message must be displayed and 10 // Gaia loading time after which error message must be displayed and
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 */ 93 */
94 samlPasswordConfirmAttempt_: 0, 94 samlPasswordConfirmAttempt_: 0,
95 95
96 /** 96 /**
97 * Whether we should show webview based signin. 97 * Whether we should show webview based signin.
98 * @type {boolean} 98 * @type {boolean}
99 * @private 99 * @private
100 */ 100 */
101 isWebviewSignin: false, 101 isWebviewSignin: false,
102 102
103 /**
104 * Whether screen is shown.
105 * @type {boolean}
106 * @private
107 */
108 isShown_: false,
109
110 /** @override */ 103 /** @override */
111 decorate: function() { 104 decorate: function() {
112 this.isWebviewSignin = loadTimeData.getValue('isWebviewSignin'); 105 this.isWebviewSignin = loadTimeData.getValue('isWebviewSignin');
113 if (this.isWebviewSignin) { 106 if (this.isWebviewSignin) {
114 // Replace iframe with webview. 107 // Replace iframe with webview.
115 var webview = this.ownerDocument.createElement('webview'); 108 var webview = this.ownerDocument.createElement('webview');
116 webview.id = 'signin-frame'; 109 webview.id = 'signin-frame';
117 webview.name = 'signin-frame'; 110 webview.name = 'signin-frame';
118 // TODO(dpolukhin): webview doesn't load page in hidden state, 111 webview.hidden = true;
119 // use curtain instead.
120 $('signin-frame').parentNode.replaceChild(webview, $('signin-frame')); 112 $('signin-frame').parentNode.replaceChild(webview, $('signin-frame'));
121 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost(webview); 113 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost(webview);
122 } else { 114 } else {
123 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); 115 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame'));
124 } 116 }
125 this.gaiaAuthHost_.addEventListener( 117 this.gaiaAuthHost_.addEventListener(
126 'ready', this.onAuthReady_.bind(this)); 118 'ready', this.onAuthReady_.bind(this));
127 this.gaiaAuthHost_.confirmPasswordCallback = 119 this.gaiaAuthHost_.confirmPasswordCallback =
128 this.onAuthConfirmPassword_.bind(this); 120 this.onAuthConfirmPassword_.bind(this);
129 this.gaiaAuthHost_.noPasswordCallback = 121 this.gaiaAuthHost_.noPasswordCallback =
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 chrome.send('updateOfflineLogin', [value]); 169 chrome.send('updateOfflineLogin', [value]);
178 }, 170 },
179 171
180 /** 172 /**
181 * Shows/hides loading UI. 173 * Shows/hides loading UI.
182 * @param {boolean} show True to show loading UI. 174 * @param {boolean} show True to show loading UI.
183 * @private 175 * @private
184 */ 176 */
185 showLoadingUI_: function(show) { 177 showLoadingUI_: function(show) {
186 $('gaia-loading').hidden = !show; 178 $('gaia-loading').hidden = !show;
187 if (!this.isWebviewSignin) { 179 $('signin-frame').hidden = show;
188 // TODO(dpolukhin): proper implement curtain for webview signin.
189 this.gaiaAuthHost_.frame.hidden = show;
190 }
191 $('signin-right').hidden = show; 180 $('signin-right').hidden = show;
192 $('enterprise-info-container').hidden = show; 181 $('enterprise-info-container').hidden = show;
193 $('gaia-signin-divider').hidden = show; 182 $('gaia-signin-divider').hidden = show;
194 }, 183 },
195 184
196 /** 185 /**
197 * Handler for Gaia loading suspiciously long timeout. 186 * Handler for Gaia loading suspiciously long timeout.
198 * @private 187 * @private
199 */ 188 */
200 onLoadingSuspiciouslyLong_: function() { 189 onLoadingSuspiciouslyLong_: function() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 SIGNIN_UI_STATE.GAIA_SIGNIN; 254 SIGNIN_UI_STATE.GAIA_SIGNIN;
266 255
267 // Ensure that GAIA signin (or loading UI) is actually visible. 256 // Ensure that GAIA signin (or loading UI) is actually visible.
268 window.requestAnimationFrame(function() { 257 window.requestAnimationFrame(function() {
269 chrome.send('loginVisible', ['gaia-loading']); 258 chrome.send('loginVisible', ['gaia-loading']);
270 }); 259 });
271 260
272 // Button header is always visible when sign in is presented. 261 // Button header is always visible when sign in is presented.
273 // Header is hidden once GAIA reports on successful sign in. 262 // Header is hidden once GAIA reports on successful sign in.
274 Oobe.getInstance().headerHidden = false; 263 Oobe.getInstance().headerHidden = false;
275 this.isShown_ = true; 264 },
276 if (this.isWebviewSignin && !this.loading) 265
277 this.gaiaAuthHost_.sendFocusReady(); 266 onAfterShow: function(data) {
267 if (!this.loading && this.isWebviewSignin)
268 $('signin-frame').focus();
278 }, 269 },
279 270
280 /** 271 /**
281 * Event handler that is invoked just before the screen is hidden. 272 * Event handler that is invoked just before the screen is hidden.
282 */ 273 */
283 onBeforeHide: function() { 274 onBeforeHide: function() {
284 chrome.send('loginUIStateChanged', ['gaia-signin', false]); 275 chrome.send('loginUIStateChanged', ['gaia-signin', false]);
285 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN; 276 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN;
286 this.isShown_ = false;
287 }, 277 },
288 278
289 /** 279 /**
290 * Loads the authentication extension into the iframe. 280 * Loads the authentication extension into the iframe.
291 * @param {Object} data Extension parameters bag. 281 * @param {Object} data Extension parameters bag.
292 * @private 282 * @private
293 */ 283 */
294 loadAuthExtension: function(data) { 284 loadAuthExtension: function(data) {
295 this.isLocal = data.isLocal; 285 this.isLocal = data.isLocal;
296 this.email = ''; 286 this.email = '';
(...skipping 24 matching lines...) Expand all
321 data.useEmbedded = false; 311 data.useEmbedded = false;
322 params.isMinuteMaidChromeOS = true; 312 params.isMinuteMaidChromeOS = true;
323 $('login-header-bar').showGuestButton = true; 313 $('login-header-bar').showGuestButton = true;
324 } 314 }
325 315
326 if (data.gaiaEndpoint) 316 if (data.gaiaEndpoint)
327 params.gaiaPath = data.gaiaEndpoint; 317 params.gaiaPath = data.gaiaEndpoint;
328 318
329 $('login-header-bar').minuteMaid = this.isMinuteMaid; 319 $('login-header-bar').minuteMaid = this.isMinuteMaid;
330 320
331
332 if (data.useEmbedded) 321 if (data.useEmbedded)
333 params.gaiaPath = 'EmbeddedSignIn'; 322 params.gaiaPath = 'EmbeddedSignIn';
334 323
335 if (data.forceReload || 324 if (data.forceReload ||
336 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) { 325 JSON.stringify(this.gaiaAuthParams_) != JSON.stringify(params)) {
337 this.error_ = 0; 326 this.error_ = 0;
338 327
339 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT; 328 var authMode = cr.login.GaiaAuthHost.AuthMode.DEFAULT;
340 if (data.useOffline) 329 if (data.useOffline)
341 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE; 330 authMode = cr.login.GaiaAuthHost.AuthMode.OFFLINE;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_); 441 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_);
453 } 442 }
454 }, 443 },
455 444
456 /** 445 /**
457 * Invoked when the auth host emits 'ready' event. 446 * Invoked when the auth host emits 'ready' event.
458 * @private 447 * @private
459 */ 448 */
460 onAuthReady_: function() { 449 onAuthReady_: function() {
461 this.loading = false; 450 this.loading = false;
462 if (this.isWebviewSignin && this.isShown_)
463 this.gaiaAuthHost_.sendFocusReady();
464 this.clearLoadingTimer_(); 451 this.clearLoadingTimer_();
465 452
466 // Show deferred error bubble. 453 // Show deferred error bubble.
467 if (this.errorBubble_) { 454 if (this.errorBubble_) {
468 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); 455 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]);
469 this.errorBubble_ = undefined; 456 this.errorBubble_ = undefined;
470 } 457 }
471 458
472 chrome.send('loginWebuiReady'); 459 chrome.send('loginWebuiReady');
473 chrome.send('loginVisible', ['gaia-signin']); 460 chrome.send('loginVisible', ['gaia-signin']);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 * For more info see C++ class 'WebUILoginView' which calls this method. 711 * For more info see C++ class 'WebUILoginView' which calls this method.
725 * @param {number} error Error code. 712 * @param {number} error Error code.
726 * @param {string} url The URL that failed to load. 713 * @param {string} url The URL that failed to load.
727 */ 714 */
728 onFrameError: function(error, url) { 715 onFrameError: function(error, url) {
729 this.error_ = error; 716 this.error_ = error;
730 chrome.send('frameLoadingCompleted', [this.error_]); 717 chrome.send('frameLoadingCompleted', [this.error_]);
731 }, 718 },
732 }; 719 };
733 }); 720 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth_host/authenticator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698