Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/screen_gaia_signin.js |
| diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js |
| index e6ed735e1db0d02436bd5a47b102f182285bac63..14f2a1e8ce9467e47e96480c2813502a4a9480b6 100644 |
| --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js |
| +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js |
| @@ -11,6 +11,11 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| // lazy portal check should be fired. |
| /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; |
| + // GAIA animation guard timer. Started when GAIA page is loaded |
| + // (Authenticator 'ready' event) and is intended to guard against edge cases |
| + // when 'showView' message is not generated/received. |
| + /** @const */ var GAIA_ANIMATION_GUARD_MILLISEC = 250; |
| + |
| // Maximum Gaia loading time in seconds. |
| /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |
| @@ -75,6 +80,14 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| loadingTimer_: undefined, |
| /** |
| + * Timer id of a guard timer that is fired in case 'showView' message |
| + * is not received from GAIA. |
| + * @type {number} |
| + * @private |
| + */ |
| + loadAnimationGuardTimer_: undefined, |
| + |
| + /** |
| * Whether user can cancel Gaia screen. |
| * @type {boolean} |
| * @private |
| @@ -197,6 +210,7 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| $('enterprise-info-container').hidden = show; |
| $('gaia-signin-divider').hidden = show; |
| this.classList.toggle('loading', show); |
| + $('signin-frame').classList.remove('show'); |
| if (!show) |
| this.classList.remove('auth-completed'); |
| }, |
| @@ -247,6 +261,37 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| }, |
| /** |
| + * Handler for GAIA animation guard timer. |
| + * @private |
| + */ |
| + onLoadAnimationGuardTimer_: function() { |
| + this.loadAnimationGuardTimer_ = undefined; |
| + this.onShowView_(); |
| + }, |
| + |
| + /** |
| + * Clears GAIA animation guard timer. |
| + * @private |
| + */ |
| + clearLoadAnimationGuardTimer_: function() { |
| + if (this.loadAnimationGuardTimer_) { |
| + 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.
|
| + this.loadAnimationGuardTimer_ = undefined; |
| + } |
| + }, |
| + |
| + /** |
| + * Sets up GAIA animation guard timer. |
| + * @private |
| + */ |
| + startLoadAnimationGuardTimer_: function() { |
| + this.clearLoadAnimationGuardTimer_(); |
| + this.loadAnimationGuardTimer_ = window.setTimeout( |
|
dzhioev (left Google)
2015/04/13 15:18:28
Drop window.
Nikita (slow)
2015/04/22 13:11:18
Done.
|
| + this.onLoadAnimationGuardTimer_.bind(this), |
| + GAIA_ANIMATION_GUARD_MILLISEC); |
| + }, |
| + |
| + /** |
| * Whether Gaia is loading. |
| * @type {boolean} |
| */ |
| @@ -460,17 +505,22 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| * @private |
| */ |
| onAuthReady_: function() { |
| - this.loading = false; |
| + if (this.isNewGaiaFlow) |
| + this.startLoadAnimationGuardTimer_(); |
| + |
| this.clearLoadingTimer_(); |
| + this.loading = false; |
| - // Show deferred error bubble. |
| - if (this.errorBubble_) { |
| - this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); |
| - this.errorBubble_ = undefined; |
| - } |
| + if (!this.isNewGaiaFlow) { |
| + // Show deferred error bubble. |
| + if (this.errorBubble_) { |
| + this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); |
| + this.errorBubble_ = undefined; |
| + } |
| - chrome.send('loginWebuiReady'); |
| - chrome.send('loginVisible', ['gaia-signin']); |
| + chrome.send('loginWebuiReady'); |
| + chrome.send('loginVisible', ['gaia-signin']); |
| + } |
| // Warm up the user images screen. |
| Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); |
| @@ -507,7 +557,17 @@ login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| * @private |
| */ |
| 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
|
| + this.clearLoadAnimationGuardTimer_(); |
| $('signin-frame').classList.add('show'); |
| + |
| + // Show deferred error bubble. |
| + if (this.errorBubble_) { |
| + this.showErrorBubble(this.errorBubble_[0], this.errorBubble_[1]); |
| + this.errorBubble_ = undefined; |
| + } |
| + |
| + chrome.send('loginWebuiReady'); |
| + chrome.send('loginVisible', ['gaia-signin']); |
| }, |
| /** |