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

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

Issue 1074183002: [cros New-GAIA] Fix load animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 5 years, 8 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 | no next file » | 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
11 // lazy portal check should be fired. 11 // lazy portal check should be fired.
12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; 12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7;
13 13
14 // GAIA animation guard timer. Started when GAIA page is loaded
15 // (Authenticator 'ready' event) and is intended to guard against edge cases
16 // when 'showView' message is not generated/received.
17 /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 250;
18
14 // Maximum Gaia loading time in seconds. 19 // Maximum Gaia loading time in seconds.
15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; 20 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60;
16 21
17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; 22 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613;
18 23
19 return { 24 return {
20 EXTERNAL_API: [ 25 EXTERNAL_API: [
21 'loadAuthExtension', 26 'loadAuthExtension',
22 'updateAuthExtension', 27 'updateAuthExtension',
23 'doReload', 28 'doReload',
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 isEnrollingConsumerManagement_: false, 73 isEnrollingConsumerManagement_: false,
69 74
70 /** 75 /**
71 * Timer id of pending load. 76 * Timer id of pending load.
72 * @type {number} 77 * @type {number}
73 * @private 78 * @private
74 */ 79 */
75 loadingTimer_: undefined, 80 loadingTimer_: undefined,
76 81
77 /** 82 /**
83 * Timer id of a guard timer that is fired in case 'showView' message
84 * is not received from GAIA.
85 * @type {number}
86 * @private
87 */
88 loadAnimationGuardTimer_: undefined,
89
90 /**
78 * Whether user can cancel Gaia screen. 91 * Whether user can cancel Gaia screen.
79 * @type {boolean} 92 * @type {boolean}
80 * @private 93 * @private
81 */ 94 */
82 cancelAllowed_: undefined, 95 cancelAllowed_: undefined,
83 96
84 /** 97 /**
85 * Whether we should show user pods on the login screen. 98 * Whether we should show user pods on the login screen.
86 * @type {boolean} 99 * @type {boolean}
87 * @private 100 * @private
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 * @param {boolean} show True to show loading UI. 203 * @param {boolean} show True to show loading UI.
191 * @private 204 * @private
192 */ 205 */
193 showLoadingUI_: function(show) { 206 showLoadingUI_: function(show) {
194 $('gaia-loading').hidden = !show; 207 $('gaia-loading').hidden = !show;
195 $('signin-frame').hidden = show; 208 $('signin-frame').hidden = show;
196 $('signin-right').hidden = show; 209 $('signin-right').hidden = show;
197 $('enterprise-info-container').hidden = show; 210 $('enterprise-info-container').hidden = show;
198 $('gaia-signin-divider').hidden = show; 211 $('gaia-signin-divider').hidden = show;
199 this.classList.toggle('loading', show); 212 this.classList.toggle('loading', show);
213 $('signin-frame').classList.remove('show');
200 if (!show) 214 if (!show)
201 this.classList.remove('auth-completed'); 215 this.classList.remove('auth-completed');
202 }, 216 },
203 217
204 /** 218 /**
205 * Handler for Gaia loading suspiciously long timeout. 219 * Handler for Gaia loading suspiciously long timeout.
206 * @private 220 * @private
207 */ 221 */
208 onLoadingSuspiciouslyLong_: function() { 222 onLoadingSuspiciouslyLong_: function() {
209 if (this != Oobe.getInstance().currentScreen) 223 if (this != Oobe.getInstance().currentScreen)
(...skipping 30 matching lines...) Expand all
240 * @private 254 * @private
241 */ 255 */
242 startLoadingTimer_: function() { 256 startLoadingTimer_: function() {
243 this.clearLoadingTimer_(); 257 this.clearLoadingTimer_();
244 this.loadingTimer_ = window.setTimeout( 258 this.loadingTimer_ = window.setTimeout(
245 this.onLoadingSuspiciouslyLong_.bind(this), 259 this.onLoadingSuspiciouslyLong_.bind(this),
246 GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC * 1000); 260 GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC * 1000);
247 }, 261 },
248 262
249 /** 263 /**
264 * Handler for GAIA animation guard timer.
265 * @private
266 */
267 onLoadAnimationGuardTimer_: function() {
268 this.loadAnimationGuardTimer_ = undefined;
269 this.onShowView_();
270 },
271
272 /**
273 * Clears GAIA animation guard timer.
274 * @private
275 */
276 clearLoadAnimationGuardTimer_: function() {
277 if (this.loadAnimationGuardTimer_) {
278 window.clearTimeout(this.loadAnimationGuardTimer_);
dzhioev (left Google) 2015/04/13 15:18:28 Just |clearTimeout| without window.
Nikita (slow) 2015/04/22 13:11:18 Done.
279 this.loadAnimationGuardTimer_ = undefined;
280 }
281 },
282
283 /**
284 * Sets up GAIA animation guard timer.
285 * @private
286 */
287 startLoadAnimationGuardTimer_: function() {
288 this.clearLoadAnimationGuardTimer_();
289 this.loadAnimationGuardTimer_ = window.setTimeout(
dzhioev (left Google) 2015/04/13 15:18:28 Drop window.
Nikita (slow) 2015/04/22 13:11:18 Done.
290 this.onLoadAnimationGuardTimer_.bind(this),
291 GAIA_ANIMATION_GUARD_MILLISEC);
292 },
293
294 /**
250 * Whether Gaia is loading. 295 * Whether Gaia is loading.
251 * @type {boolean} 296 * @type {boolean}
252 */ 297 */
253 get loading() { 298 get loading() {
254 return !$('gaia-loading').hidden; 299 return !$('gaia-loading').hidden;
255 }, 300 },
256 set loading(loading) { 301 set loading(loading) {
257 if (loading == this.loading) 302 if (loading == this.loading)
258 return; 303 return;
259 304
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 if (this.isNewGaiaFlow) 498 if (this.isNewGaiaFlow)
454 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_); 499 $('close-button-item').hidden = !(isSAML || this.cancelAllowed_);
455 } 500 }
456 }, 501 },
457 502
458 /** 503 /**
459 * Invoked when the auth host emits 'ready' event. 504 * Invoked when the auth host emits 'ready' event.
460 * @private 505 * @private
461 */ 506 */
462 onAuthReady_: function() { 507 onAuthReady_: function() {
508 if (this.isNewGaiaFlow)
509 this.startLoadAnimationGuardTimer_();
510
511 this.clearLoadingTimer_();
463 this.loading = false; 512 this.loading = false;
464 this.clearLoadingTimer_();
465 513
466 // Show deferred error bubble. 514 if (!this.isNewGaiaFlow) {
467 if (this.errorBubble_) { 515 // Show deferred error bubble.
468 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); 516 if (this.errorBubble_) {
469 this.errorBubble_ = undefined; 517 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]);
518 this.errorBubble_ = undefined;
519 }
520
521 chrome.send('loginWebuiReady');
522 chrome.send('loginVisible', ['gaia-signin']);
470 } 523 }
471 524
472 chrome.send('loginWebuiReady');
473 chrome.send('loginVisible', ['gaia-signin']);
474
475 // Warm up the user images screen. 525 // Warm up the user images screen.
476 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); 526 Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER});
477 }, 527 },
478 528
479 /** 529 /**
480 * Invoked when the auth host emits 'dialogShown' event. 530 * Invoked when the auth host emits 'dialogShown' event.
481 * @private 531 * @private
482 */ 532 */
483 onDialogShown_: function() { 533 onDialogShown_: function() {
484 $('back-button-item').disabled = true; 534 $('back-button-item').disabled = true;
(...skipping 14 matching lines...) Expand all
499 * @private 549 * @private
500 */ 550 */
501 onBackButton_: function(e) { 551 onBackButton_: function(e) {
502 $('back-button-item').hidden = !e.detail; 552 $('back-button-item').hidden = !e.detail;
503 }, 553 },
504 554
505 /** 555 /**
506 * Invoked when the auth host emits 'showView' event. 556 * Invoked when the auth host emits 'showView' event.
507 * @private 557 * @private
508 */ 558 */
509 onShowView_: function(e) { 559 onShowView_: function(e) {
dzhioev (left Google) 2015/04/13 15:18:28 Try to switch 'loading' state and focus webview in
Nikita (slow) 2015/04/22 13:11:18 Try that and there's a degraded UX since user is a
560 this.clearLoadAnimationGuardTimer_();
510 $('signin-frame').classList.add('show'); 561 $('signin-frame').classList.add('show');
562
563 // Show deferred error bubble.
564 if (this.errorBubble_) {
565 this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]);
566 this.errorBubble_ = undefined;
567 }
568
569 chrome.send('loginWebuiReady');
570 chrome.send('loginVisible', ['gaia-signin']);
511 }, 571 },
512 572
513 /** 573 /**
514 * Invoked when the user has successfully authenticated via SAML, the 574 * Invoked when the user has successfully authenticated via SAML, the
515 * principals API was not used and the auth host needs the user to confirm 575 * principals API was not used and the auth host needs the user to confirm
516 * the scraped password. 576 * the scraped password.
517 * @param {number} passwordCount The number of passwords that were scraped. 577 * @param {number} passwordCount The number of passwords that were scraped.
518 * @private 578 * @private
519 */ 579 */
520 onAuthConfirmPassword_: function(passwordCount) { 580 onAuthConfirmPassword_: function(passwordCount) {
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 } 859 }
800 860
801 this.classList.toggle('whitelist-error', show); 861 this.classList.toggle('whitelist-error', show);
802 this.loading = !show; 862 this.loading = !show;
803 863
804 if (!show) 864 if (!show)
805 Oobe.showSigninUI(); 865 Oobe.showSigninUI();
806 }, 866 },
807 }; 867 };
808 }); 868 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698