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..cf870cb53baca5ec3de907137a30ce181138a8de 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 @@ |
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,7 +163,21 @@ |
/** |
* 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 a GAIA error occurs |
+ * during authentication. |
+ * @type {function()} |
+ */ |
+ missingGaiaInfoCallback_: null, |
+ |
+ /** |
+ * Invoked to record that the credentials passing API was used. |
+ * @type {function()} |
+ */ |
+ samlApiUsedCallback_: null, |
/** |
* The iframe container. |
@@ -186,14 +188,6 @@ |
}, |
/** |
- * Sets retrieveAuthenticatedUserEmailCallback_. |
- * @type {function()} |
- */ |
- set retrieveAuthenticatedUserEmailCallback(callback) { |
- this.retrieveAuthenticatedUserEmailCallback_ = callback; |
- }, |
- |
- /** |
* Sets confirmPasswordCallback_. |
* @type {function()} |
*/ |
@@ -215,6 +209,22 @@ |
*/ |
set insecureContentBlockedCallback(callback) { |
this.insecureContentBlockedCallback_ = callback; |
+ }, |
+ |
+ /** |
+ * Sets missingGaiaInfoCallback_. |
+ * @type {function()} |
+ */ |
+ set missingGaiaInfoCallback(callback) { |
+ this.missingGaiaInfoCallback_ = callback; |
+ }, |
+ |
+ /** |
+ * Sets samlApiUsedCallback_. |
+ * @type {function()} |
+ */ |
+ set samlApiUsedCallback(callback) { |
+ this.samlApiUsedCallback_ = callback; |
}, |
/** |
@@ -286,21 +296,6 @@ |
}, |
/** |
- * 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,22 +341,12 @@ |
} |
this.onAuthSuccess_({email: msg.email, |
password: msg.password, |
+ gaiaId: msg.gaiaId, |
useOffline: msg.method == 'offlineLogin', |
usingSAML: msg.usingSAML || false, |
chooseWhatToSync: msg.chooseWhatToSync, |
skipForNow: msg.skipForNow || false, |
sessionIndex: msg.sessionIndex || ''}); |
- return; |
- } |
- |
- if (msg.method == 'retrieveAuthenticatedUserEmail') { |
- if (this.retrieveAuthenticatedUserEmailCallback_) { |
- this.retrieveAuthenticatedUserEmailCallback_(msg.attemptToken, |
- msg.apiUsed); |
- } else { |
- console.error( |
- 'GaiaAuthHost: Invalid retrieveAuthenticatedUserEmailCallback_.'); |
- } |
return; |
} |
@@ -402,6 +387,24 @@ |
return; |
} |
+ if (msg.method == 'missingGaiaInfo') { |
+ if (this.missingGaiaInfoCallback_) { |
+ this.missingGaiaInfoCallback_(); |
+ } else { |
+ console.error('GaiaAuthHost: Invalid missingGaiaInfoCallback_.'); |
+ } |
+ return; |
+ } |
+ |
+ if (msg.method == 'samlApiUsed') { |
+ if (this.samlApiUsedCallback_) { |
+ this.samlApiUsedCallback_(); |
+ } else { |
+ console.error('GaiaAuthHost: Invalid samlApiUsedCallback_.'); |
+ } |
+ return; |
+ } |
+ |
console.error('Unknown message method=' + msg.method); |
} |
}; |