Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6315)

Unified Diff: chrome/browser/resources/gaia_auth_host/gaia_auth_host.js

Issue 902493003: cros: Pass gaia_auth init params via postMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/gaia_auth/util.js ('k') | chrome/browser/ui/webui/signin/inline_login_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b33c3472be543657e5dc078f6745df2c3b1307d4..aedb60be3c8e1d77559fc5a52041a04ed0cdeaf1 100644
--- a/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
+++ b/chrome/browser/resources/gaia_auth_host/gaia_auth_host.js
@@ -110,6 +110,12 @@ cr.define('cr.login', function() {
__proto__: cr.EventTarget.prototype,
/**
+ * Auth extension params
+ * @type {Object}
+ */
+ authParams_: {},
+
+ /**
* An url to use with {@code reload}.
* @type {?string}
* @private
@@ -237,7 +243,7 @@ cr.define('cr.login', function() {
* invoked with a credential object.
*/
load: function(authMode, data, successCallback) {
- var params = [];
+ var params = {};
var populateParams = function(nameList, values) {
if (!values)
@@ -246,14 +252,13 @@ cr.define('cr.login', function() {
for (var i in nameList) {
var name = nameList[i];
if (values[name])
- params.push(name + '=' + encodeURIComponent(values[name]));
+ params[name] = values[name];
}
};
populateParams(SUPPORTED_PARAMS, data);
populateParams(LOCALIZED_STRING_PARAMS, data.localizedStrings);
- params.push('parentPage=' + encodeURIComponent(window.location.origin));
- params.push('needPassword=1');
+ params['needPassword'] = true;
var url;
switch (authMode) {
@@ -262,23 +267,29 @@ cr.define('cr.login', function() {
break;
case AuthMode.DESKTOP:
url = AUTH_URL;
- params.push('desktopMode=1');
+ params['desktopMode'] = true;
break;
default:
url = AUTH_URL;
}
- url += '?' + params.join('&');
- this.frame_.src = url;
+ this.authParams_ = params;
this.reloadUrl_ = url;
this.successCallback_ = successCallback;
- this.authFlow = AuthFlow.GAIA;
+
+ this.reload();
},
/**
* Reloads the auth extension.
*/
reload: function() {
+ var sendParamsOnLoad = function() {
+ this.frame_.removeEventListener('load', sendParamsOnLoad);
+ this.frame_.contentWindow.postMessage(this.authParams_, AUTH_URL_BASE);
+ }.bind(this);
+
+ this.frame_.addEventListener('load', sendParamsOnLoad);
this.frame_.src = this.reloadUrl_;
this.authFlow = AuthFlow.GAIA;
},
« no previous file with comments | « chrome/browser/resources/gaia_auth/util.js ('k') | chrome/browser/ui/webui/signin/inline_login_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698