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..2e639d7b46d0378c1b7b1839b1b3a23b42a0fbc7 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,22 +163,28 @@ 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, |
| /** |
| - * The iframe container. |
| - * @type {HTMLIFrameElement} |
| + * Invoked to display an error message to the user when a GAIA error occurs |
| + * during authentication. |
| + * @type {function()} |
| */ |
| - get frame() { |
| - return this.frame_; |
| - }, |
| + missingGaiaInfoCallback_: null, |
| /** |
| - * Sets retrieveAuthenticatedUserEmailCallback_. |
| + * Invoked to record that the SAML API was used. |
|
bartfab (slow)
2014/10/21 14:47:47
Nit: Could you change this to "credentials passing
Roger Tawa OOO till Jul 10th
2014/10/21 19:15:31
Done.
|
| * @type {function()} |
| */ |
| - set retrieveAuthenticatedUserEmailCallback(callback) { |
| - this.retrieveAuthenticatedUserEmailCallback_ = callback; |
| + samlApiUsedCallback_: null, |
| + |
| + /** |
| + * The iframe container. |
| + * @type {HTMLIFrameElement} |
| + */ |
| + get frame() { |
| + return this.frame_; |
| }, |
| /** |
| @@ -218,6 +212,22 @@ cr.define('cr.login', function() { |
| }, |
| /** |
| + * Sets missingGaiaInfoCallback_. |
| + * @type {function()} |
| + */ |
| + set missingGaiaInfoCallback(callback) { |
| + this.missingGaiaInfoCallback_ = callback; |
| + }, |
| + |
| + /** |
| + * Sets samlApiUsedCallback_. |
| + * @type {function()} |
| + */ |
| + set samlApiUsedCallback(callback) { |
| + this.samlApiUsedCallback_ = callback; |
| + }, |
| + |
| + /** |
| * Loads the auth extension. |
| * @param {AuthMode} authMode Authorization mode. |
| * @param {Object} data Parameters for the auth extension. See the auth |
| @@ -286,21 +296,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 +341,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 +350,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 +387,24 @@ cr.define('cr.login', function() { |
| return; |
| } |
| + if (msg.method == 'missingGaiaInfo') { |
| + if (this.missingGaiaInfoCallback_) { |
| + this.missingGaiaInfoCallback_(); |
| + } else { |
| + console.error('GaiaAuthHost: Invalid missingGaiaInfoCallback.'); |
|
bartfab (slow)
2014/10/21 14:47:47
Nit: s/missingGaiaInfoCallback/missingGaiaInfoCall
Roger Tawa OOO till Jul 10th
2014/10/21 19:15:31
Done.
|
| + } |
| + return; |
| + } |
| + |
| + if (msg.method == 'samlApiUsed') { |
| + if (this.samlApiUsedCallback_) { |
| + this.samlApiUsedCallback_(); |
| + } else { |
| + console.error('GaiaAuthHost: Invalid samlApiUsedCallback.'); |
|
bartfab (slow)
2014/10/21 14:47:47
Nit: s/samlApiUsedCallback/samlApiUsedCallback_/ (
Roger Tawa OOO till Jul 10th
2014/10/21 19:15:31
Done.
|
| + } |
| + return; |
| + } |
| + |
| console.error('Unknown message method=' + msg.method); |
| } |
| }; |