Index: chrome/browser/resources/gaia_auth/main.js |
diff --git a/chrome/browser/resources/gaia_auth/main.js b/chrome/browser/resources/gaia_auth/main.js |
index 41f5116fff64978fe281fe376a4ffc93902131c3..fa186e48d3daee4da2cce3fae39b51743619b5bf 100644 |
--- a/chrome/browser/resources/gaia_auth/main.js |
+++ b/chrome/browser/resources/gaia_auth/main.js |
@@ -63,7 +63,6 @@ Authenticator.prototype = { |
intputEmail_: undefined, |
isSAMLFlow_: false, |
- isSAMLEnabled_: false, |
supportChannel_: null, |
GAIA_URL: 'https://accounts.google.com/', |
@@ -88,11 +87,6 @@ Authenticator.prototype = { |
this.initialFrameUrlWithoutParams_ = stripParams(this.initialFrameUrl_); |
document.addEventListener('DOMContentLoaded', this.onPageLoad_.bind(this)); |
- if (!this.desktopMode_) { |
- // SAML is always enabled in desktop mode, thus no need to listen for |
- // enableSAML event. |
- document.addEventListener('enableSAML', this.onEnableSAML_.bind(this)); |
- } |
}, |
isGaiaMessage_: function(msg) { |
@@ -129,18 +123,17 @@ Authenticator.prototype = { |
var gaiaFrame = $('gaia-frame'); |
gaiaFrame.src = this.initialFrameUrl_; |
- if (this.desktopMode_) { |
- var handler = function() { |
+ var handler = function() { |
+ if (this.desktopMode_) |
this.onLoginUILoaded_(); |
- gaiaFrame.removeEventListener('load', handler); |
+ gaiaFrame.removeEventListener('load', handler); |
- this.initDesktopChannel_(); |
- }.bind(this); |
- gaiaFrame.addEventListener('load', handler); |
- } |
+ this.initSupportChannel_(); |
+ }.bind(this); |
+ gaiaFrame.addEventListener('load', handler); |
}, |
- initDesktopChannel_: function() { |
+ initSupportChannel_: function() { |
this.supportChannel_ = new Channel(); |
this.supportChannel_.connect('authMain'); |
@@ -148,18 +141,19 @@ Authenticator.prototype = { |
this.supportChannel_.registerMessage('channelConnected', function() { |
channelConnected = true; |
- this.supportChannel_.send({ |
- name: 'initDesktopFlow', |
- gaiaUrl: this.gaiaUrl_, |
- continueUrl: stripParams(this.continueUrl_), |
- isConstrainedWindow: this.isConstrainedWindow_ |
- }); |
- this.supportChannel_.registerMessage( |
- 'switchToFullTab', this.switchToFullTab_.bind(this)); |
- this.supportChannel_.registerMessage( |
- 'completeLogin', this.completeLogin_.bind(this)); |
- |
- this.onEnableSAML_(); |
+ if (this.desktopMode_) { |
+ this.supportChannel_.send({ |
+ name: 'initDesktopFlow', |
+ gaiaUrl: this.gaiaUrl_, |
+ continueUrl: stripParams(this.continueUrl_), |
+ isConstrainedWindow: this.isConstrainedWindow_ |
+ }); |
+ this.supportChannel_.registerMessage( |
+ 'switchToFullTab', this.switchToFullTab_.bind(this)); |
+ this.supportChannel_.registerMessage( |
+ 'completeLogin', this.completeLogin_.bind(this)); |
+ } |
+ this.initSAML_(); |
}.bind(this)); |
window.setTimeout(function() { |
@@ -210,23 +204,15 @@ Authenticator.prototype = { |
'sessionIndex': opt_extraMsg && opt_extraMsg.sessionIndex |
}; |
window.parent.postMessage(msg, this.parentPage_); |
- if (this.isSAMLEnabled_) |
- this.supportChannel_.send({name: 'resetAuth'}); |
+ this.supportChannel_.send({name: 'resetAuth'}); |
}, |
/** |
- * Invoked when 'enableSAML' event is received to initialize SAML support on |
- * Chrome OS, or when initDesktopChannel_ is called on desktop. |
+ * Invoded when support channel is connected. |
bartfab (slow)
2014/07/14 10:12:40
Nit: s/Invoded/Invoked/
dzhioev (left Google)
2014/07/15 18:34:08
Done.
|
*/ |
- onEnableSAML_: function() { |
- this.isSAMLEnabled_ = true; |
+ initSAML_: function() { |
this.isSAMLFlow_ = false; |
- if (!this.supportChannel_) { |
- this.supportChannel_ = new Channel(); |
- this.supportChannel_.connect('authMain'); |
- } |
- |
this.supportChannel_.registerMessage( |
'onAuthPageLoaded', this.onAuthPageLoaded_.bind(this)); |
this.supportChannel_.registerMessage( |
@@ -400,16 +386,14 @@ Authenticator.prototype = { |
this.attemptToken_ = msg.attemptToken; |
this.chooseWhatToSync_ = msg.chooseWhatToSync; |
this.isSAMLFlow_ = false; |
- if (this.isSAMLEnabled_) |
- this.supportChannel_.send({name: 'startAuth'}); |
+ this.supportChannel_.send({name: 'startAuth'}); |
} else if (msg.method == 'clearOldAttempts' && this.isGaiaMessage_(e)) { |
this.email_ = null; |
this.passwordBytes_ = null; |
this.attemptToken_ = null; |
this.isSAMLFlow_ = false; |
this.onLoginUILoaded_(); |
- if (this.isSAMLEnabled_) |
- this.supportChannel_.send({name: 'resetAuth'}); |
+ this.supportChannel_.send({name: 'resetAuth'}); |
} else if (msg.method == 'setAuthenticatedUserEmail' && |
this.isParentMessage_(e)) { |
if (this.attemptToken_ == msg.attemptToken) { |