Chromium Code Reviews| Index: chrome/browser/resources/gaia_auth_host/gaia_auth_host.js |
| diff --git a/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js b/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js |
| index e835e20e79993e9c06e4b320f64fbae1e28cc766..69b4ec644305cca4096eff32b8db9ae2afab14a5 100644 |
| --- a/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js |
| +++ b/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js |
| @@ -141,18 +141,6 @@ cr.define('cr.login', function() { |
| successCallback_: null, |
| /** |
| - * Invoked when GAIA indicates login success and SAML was used. At this |
| - * point, GAIA cookies are present but the identity of the authenticated |
| - * user is not known. The embedder of GaiaAuthHost should extract the GAIA |
| - * cookies from the cookie jar, query GAIA for the authenticated user's |
| - * e-mail address and invoke GaiaAuthHost.setAuthenticatedUserEmail with the |
| - * result. The argument is an opaque token that should be passed back to |
| - * GaiaAuthHost.setAuthenticatedUserEmail. |
| - * @type {function(number)} |
| - */ |
| - retrieveAuthenticatedUserEmailCallback_: null, |
| - |
| - /** |
| * Invoked when the auth flow needs a user to confirm his/her passwords. |
| * This could happen when there are more than one passwords scraped during |
| * SAML flow. The embedder of GaiaAuthHost should show an UI to collect a |
| @@ -175,9 +163,17 @@ cr.define('cr.login', function() { |
| /** |
| * Invoked when the authentication flow had to be aborted because content |
| * served over an unencrypted connection was detected. |
| + */ |
| insecureContentBlockedCallback_: null, |
| /** |
| + * Invoked to display an error message to the user when an error occurs |
| + * during authentication. The function argument is the message to show. |
| + * @type {function(string)} |
| + */ |
| + showFatalAuthErrorCallback_: null, |
| + |
| + /** |
| * The iframe container. |
| * @type {HTMLIFrameElement} |
| */ |
| @@ -186,14 +182,6 @@ cr.define('cr.login', function() { |
| }, |
| /** |
| - * Sets retrieveAuthenticatedUserEmailCallback_. |
| - * @type {function()} |
| - */ |
| - set retrieveAuthenticatedUserEmailCallback(callback) { |
| - this.retrieveAuthenticatedUserEmailCallback_ = callback; |
| - }, |
| - |
| - /** |
| * Sets confirmPasswordCallback_. |
| * @type {function()} |
| */ |
| @@ -218,6 +206,14 @@ cr.define('cr.login', function() { |
| }, |
| /** |
| + * Sets showFatalAuthErrorCallback_. |
| + * @type {function()} |
| + */ |
| + set showFatalAuthErrorCallback(callback) { |
| + this.showFatalAuthErrorCallback_ = callback; |
| + }, |
| + |
| + /** |
| * Loads the auth extension. |
| * @param {AuthMode} authMode Authorization mode. |
| * @param {Object} data Parameters for the auth extension. See the auth |
| @@ -286,21 +282,6 @@ cr.define('cr.login', function() { |
| }, |
| /** |
| - * Sends the authenticated user's e-mail address to the auth extension. |
| - * @param {number} attemptToken The opaque token provided to the |
| - * retrieveAuthenticatedUserEmailCallback_. |
| - * @param {string} email The authenticated user's e-mail address. |
| - */ |
| - setAuthenticatedUserEmail: function(attemptToken, email) { |
| - var msg = { |
| - method: 'setAuthenticatedUserEmail', |
| - attemptToken: attemptToken, |
| - email: email |
| - }; |
| - this.frame_.contentWindow.postMessage(msg, AUTH_URL_BASE); |
| - }, |
| - |
| - /** |
| * Invoked to process authentication success. |
| * @param {Object} credentials Credential object to pass to success |
| * callback. |
| @@ -346,6 +327,7 @@ cr.define('cr.login', function() { |
| } |
| this.onAuthSuccess_({email: msg.email, |
| password: msg.password, |
| + gaiaId: msg.gaiaId, |
| useOffline: msg.method == 'offlineLogin', |
| usingSAML: msg.usingSAML || false, |
| chooseWhatToSync: msg.chooseWhatToSync, |
| @@ -354,17 +336,6 @@ cr.define('cr.login', function() { |
| return; |
| } |
| - if (msg.method == 'retrieveAuthenticatedUserEmail') { |
| - if (this.retrieveAuthenticatedUserEmailCallback_) { |
| - this.retrieveAuthenticatedUserEmailCallback_(msg.attemptToken, |
| - msg.apiUsed); |
| - } else { |
| - console.error( |
| - 'GaiaAuthHost: Invalid retrieveAuthenticatedUserEmailCallback_.'); |
| - } |
| - return; |
| - } |
| - |
| if (msg.method == 'confirmPassword') { |
| if (this.confirmPasswordCallback_) |
| this.confirmPasswordCallback_(msg.passwordCount); |
| @@ -402,6 +373,11 @@ cr.define('cr.login', function() { |
| return; |
| } |
| + if (msg.method == 'showFatalAuthError') { |
| + this.showFatalAuthErrorCallback_(msg.message); |
|
bartfab (slow)
2014/10/17 09:54:56
Instead of a generic |showFatalAuthErrorCallback_|
Roger Tawa OOO till Jul 10th
2014/10/20 16:04:00
Done.
|
| + return; |
| + } |
| + |
| console.error('Unknown message method=' + msg.method); |
| } |
| }; |