Index: chrome/browser/resources/gaia_auth_host/authenticator.js |
diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js |
index aa75f8aeac5095d25c773595cc267b35260dbe3e..f4e0e9376561e327964447683f5805aa2cfac39a 100644 |
--- a/chrome/browser/resources/gaia_auth_host/authenticator.js |
+++ b/chrome/browser/resources/gaia_auth_host/authenticator.js |
@@ -32,6 +32,7 @@ cr.define('cr.login', function() { |
var SERVICE_ID = 'chromeoslogin'; |
var EMBEDDED_SETUP_CHROMEOS_ENDPOINT = 'embedded/setup/chromeos'; |
var SAML_REDIRECTION_PATH = 'samlredirect'; |
+ var BLANK_PAGE_URL = 'about:blank'; |
/** |
* The source URL parameter for the constrained signin flow. |
@@ -196,7 +197,7 @@ cr.define('cr.login', function() { |
* Reinitializes authentication parameters so that a failed login attempt |
* would not result in an infinite loop. |
*/ |
- Authenticator.prototype.resetStates_ = function() { |
+ Authenticator.prototype.resetStates = function() { |
this.isLoaded_ = false; |
this.email_ = null; |
this.gaiaId_ = null; |
@@ -216,13 +217,21 @@ cr.define('cr.login', function() { |
}; |
/** |
+ * Resets the webview to the blank page. |
+ */ |
+ Authenticator.prototype.resetWebview = function() { |
+ if (this.webview_.src && this.webview_.src != BLANK_PAGE_URL) |
+ this.webview_.src = BLANK_PAGE_URL; |
+ }; |
+ |
+ /** |
* Loads the authenticator component with the given parameters. |
* @param {AuthMode} authMode Authorization mode. |
* @param {Object} data Parameters for the authorization flow. |
*/ |
Authenticator.prototype.load = function(authMode, data) { |
this.authMode = authMode; |
- this.resetStates_(); |
+ this.resetStates(); |
// gaiaUrl parameter is used for testing. Once defined, it is never changed. |
this.idpOrigin_ = data.gaiaUrl || IDP_ORIGIN; |
this.continueUrl_ = data.continueUrl || CONTINUE_URL; |
@@ -270,7 +279,7 @@ cr.define('cr.login', function() { |
* Reloads the authenticator component. |
*/ |
Authenticator.prototype.reload = function() { |
- this.resetStates_(); |
+ this.resetStates(); |
this.webview_.src = this.reloadUrl_; |
this.isLoaded_ = true; |
}; |
@@ -703,7 +712,7 @@ cr.define('cr.login', function() { |
gapsCookie: this.newGapsCookie_ || this.gapsCookie_ || '', |
} |
})); |
- this.resetStates_(); |
+ this.resetStates(); |
}; |
/** |
@@ -786,6 +795,8 @@ cr.define('cr.login', function() { |
this.fireReadyEvent_(); |
// Focus webview after dispatching event when webview is already visible. |
this.webview_.focus(); |
+ } else if (currentUrl == BLANK_PAGE_URL) { |
+ this.fireReadyEvent_(); |
} |
}; |