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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 this.parentPage_ = params.parentPage || this.PARENT_PAGE; | 49 this.parentPage_ = params.parentPage || this.PARENT_PAGE; |
| 50 this.gaiaUrl_ = params.gaiaUrl || this.GAIA_URL; | 50 this.gaiaUrl_ = params.gaiaUrl || this.GAIA_URL; |
| 51 this.inputLang_ = params.hl; | 51 this.inputLang_ = params.hl; |
| 52 this.inputEmail_ = params.email; | 52 this.inputEmail_ = params.email; |
| 53 this.service_ = params.service || this.SERVICE_ID; | 53 this.service_ = params.service || this.SERVICE_ID; |
| 54 this.continueUrl_ = params.continueUrl || this.CONTINUE_URL; | 54 this.continueUrl_ = params.continueUrl || this.CONTINUE_URL; |
| 55 this.continueUrlWithoutParams_ = | 55 this.continueUrlWithoutParams_ = |
| 56 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || | 56 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || |
| 57 this.continueUrl_; | 57 this.continueUrl_; |
| 58 this.inlineMode_ = params.inlineMode; | 58 this.inlineMode_ = params.inlineMode; |
| 59 this.partitionId_ = params.partitionId || ''; | |
| 59 | 60 |
| 60 document.addEventListener('DOMContentLoaded', this.onPageLoad.bind(this)); | 61 document.addEventListener('DOMContentLoaded', this.onPageLoad.bind(this)); |
| 61 document.addEventListener('enableSAML', this.onEnableSAML_.bind(this)); | 62 document.addEventListener('enableSAML', this.onEnableSAML_.bind(this)); |
| 62 }, | 63 }, |
| 63 | 64 |
| 64 isGaiaMessage_: function(msg) { | 65 isGaiaMessage_: function(msg) { |
| 65 // Not quite right, but good enough. | 66 // Not quite right, but good enough. |
| 66 return this.gaiaUrl_.indexOf(msg.origin) == 0 || | 67 return this.gaiaUrl_.indexOf(msg.origin) == 0 || |
| 67 this.GAIA_URL.indexOf(msg.origin) == 0; | 68 this.GAIA_URL.indexOf(msg.origin) == 0; |
| 68 }, | 69 }, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 /** | 122 /** |
| 122 * Callback when the gaia webview attempts to open a new window. | 123 * Callback when the gaia webview attempts to open a new window. |
| 123 */ | 124 */ |
| 124 onWebviewNewWindow_: function(gaiaFrame, e) { | 125 onWebviewNewWindow_: function(gaiaFrame, e) { |
| 125 window.open(e.targetUrl, '_blank'); | 126 window.open(e.targetUrl, '_blank'); |
| 126 e.window.discard(); | 127 e.window.discard(); |
| 127 }, | 128 }, |
| 128 | 129 |
| 129 loadFrame_: function() { | 130 loadFrame_: function() { |
| 130 var gaiaFrame = $('gaia-frame'); | 131 var gaiaFrame = $('gaia-frame'); |
| 132 gaiaFrame.partition = this.partitionId_; | |
|
lazyboy
2013/11/04 21:08:29
I'm wondering since partitionId_ is an increasing
guohui
2013/11/05 14:35:36
this is ok. In our use case, we always want a clea
| |
| 131 gaiaFrame.src = this.getFrameUrl_(); | 133 gaiaFrame.src = this.getFrameUrl_(); |
| 132 if (this.inlineMode_) { | 134 if (this.inlineMode_) { |
| 133 gaiaFrame.addEventListener( | 135 gaiaFrame.addEventListener( |
| 134 'loadstop', this.onWebviewLoadstop_.bind(this, gaiaFrame)); | 136 'loadstop', this.onWebviewLoadstop_.bind(this, gaiaFrame)); |
| 135 gaiaFrame.addEventListener( | 137 gaiaFrame.addEventListener( |
| 136 'newwindow', this.onWebviewNewWindow_.bind(this, gaiaFrame)); | 138 'newwindow', this.onWebviewNewWindow_.bind(this, gaiaFrame)); |
| 137 } | 139 } |
| 138 }, | 140 }, |
| 139 | 141 |
| 140 completeLogin: function(username, password) { | 142 completeLogin: function(username, password) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 } else if (msg.method == 'navigate' && | 253 } else if (msg.method == 'navigate' && |
| 252 this.isParentMessage_(e)) { | 254 this.isParentMessage_(e)) { |
| 253 $('gaia-frame').src = msg.src; | 255 $('gaia-frame').src = msg.src; |
| 254 } else { | 256 } else { |
| 255 console.error('Authenticator.onMessage: unknown message + origin!?'); | 257 console.error('Authenticator.onMessage: unknown message + origin!?'); |
| 256 } | 258 } |
| 257 } | 259 } |
| 258 }; | 260 }; |
| 259 | 261 |
| 260 Authenticator.getInstance().initialize(); | 262 Authenticator.getInstance().initialize(); |
| OLD | NEW |