Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Authenticator class wraps the communications between Gaia and its host. | 6 * Authenticator class wraps the communications between Gaia and its host. |
| 7 */ | 7 */ |
| 8 function Authenticator() { | 8 function Authenticator() { |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 } | 217 } |
| 218 this.supportChannel_.registerMessage( | 218 this.supportChannel_.registerMessage( |
| 219 'completeLogin', this.onCompleteLogin_.bind(this)); | 219 'completeLogin', this.onCompleteLogin_.bind(this)); |
| 220 this.initSAML_(); | 220 this.initSAML_(); |
| 221 this.supportChannel_.send({name: 'resetAuth'}); | 221 this.supportChannel_.send({name: 'resetAuth'}); |
| 222 this.maybeInitialized_(); | 222 this.maybeInitialized_(); |
| 223 }.bind(this)); | 223 }.bind(this)); |
| 224 | 224 |
| 225 window.setTimeout(function() { | 225 window.setTimeout(function() { |
| 226 if (!this.supportChannel_) { | 226 if (!this.supportChannel_) { |
| 227 // Give up previous channel and bind its 'channelConnected' to a no-op. | |
| 228 supportChannel.registerMessage('channelConnected', function() {}); | |
|
xiyuan
2015/06/10 05:40:18
This does not work. Old message handler is called
| |
| 229 | |
| 227 // Re-initialize the channel if it is not connected properly, e.g. | 230 // Re-initialize the channel if it is not connected properly, e.g. |
| 228 // connect may be called before background script started running. | 231 // connect may be called before background script started running. |
| 229 this.initSupportChannel_(); | 232 this.initSupportChannel_(); |
| 230 } | 233 } |
| 231 }.bind(this), 200); | 234 }.bind(this), 200); |
| 232 }, | 235 }, |
| 233 | 236 |
| 234 /** | 237 /** |
| 235 * Called when one of the initialization stages has finished. If all the | 238 * Called when one of the initialization stages has finished. If all the |
| 236 * needed parts are initialized, notifies parent about successfull | 239 * needed parts are initialized, notifies parent about successfull |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 } else if (msg.method == 'redirectToSignin' && | 544 } else if (msg.method == 'redirectToSignin' && |
| 542 this.isParentMessage_(e)) { | 545 this.isParentMessage_(e)) { |
| 543 $('gaia-frame').src = this.constructInitialFrameUrl_(); | 546 $('gaia-frame').src = this.constructInitialFrameUrl_(); |
| 544 } else { | 547 } else { |
| 545 console.error('Authenticator.onMessage: unknown message + origin!?'); | 548 console.error('Authenticator.onMessage: unknown message + origin!?'); |
| 546 } | 549 } |
| 547 } | 550 } |
| 548 }; | 551 }; |
| 549 | 552 |
| 550 Authenticator.getInstance().initialize(); | 553 Authenticator.getInstance().initialize(); |
| OLD | NEW |