| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @fileoverview An UI component to authenciate to Chrome. The component hosts | 6 * @fileoverview An UI component to authenciate to Chrome. The component hosts |
| 7 * IdP web pages in a webview. A client who is interested in monitoring | 7 * IdP web pages in a webview. A client who is interested in monitoring |
| 8 * authentication events should pass a listener object of type | 8 * authentication events should pass a listener object of type |
| 9 * cr.login.GaiaAuthHost.Listener as defined in this file. After initialization, | 9 * cr.login.GaiaAuthHost.Listener as defined in this file. After initialization, |
| 10 * call {@code load} to start the authentication flow. | 10 * call {@code load} to start the authentication flow. |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 /** | 244 /** |
| 245 * Invoked when an HTML5 message is received from the webview element. | 245 * Invoked when an HTML5 message is received from the webview element. |
| 246 * @param {object} e Payload of the received HTML5 message. | 246 * @param {object} e Payload of the received HTML5 message. |
| 247 * @private | 247 * @private |
| 248 */ | 248 */ |
| 249 Authenticator.prototype.onMessageFromWebview_ = function(e) { | 249 Authenticator.prototype.onMessageFromWebview_ = function(e) { |
| 250 // The event origin does not have a trailing slash. | 250 // The event origin does not have a trailing slash. |
| 251 if (e.origin != this.idpOrigin_.substring(0, this.idpOrigin_ - 1)) { | 251 if (e.origin != this.idpOrigin_.substring(0, this.idpOrigin_.length - 1)) { |
| 252 return; | 252 return; |
| 253 } | 253 } |
| 254 | 254 |
| 255 var msg = e.data; | 255 var msg = e.data; |
| 256 if (msg.method == 'attemptLogin') { | 256 if (msg.method == 'attemptLogin') { |
| 257 this.email_ = msg.email; | 257 this.email_ = msg.email; |
| 258 this.password_ = msg.password; | 258 this.password_ = msg.password; |
| 259 this.chooseWhatToSync_ = msg.chooseWhatToSync; | 259 this.chooseWhatToSync_ = msg.chooseWhatToSync; |
| 260 } | 260 } |
| 261 }; | 261 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 Authenticator.AuthFlow = AuthFlow; | 305 Authenticator.AuthFlow = AuthFlow; |
| 306 Authenticator.AuthMode = AuthMode; | 306 Authenticator.AuthMode = AuthMode; |
| 307 | 307 |
| 308 return { | 308 return { |
| 309 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 309 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
| 310 // iframe-based flow is deprecated. | 310 // iframe-based flow is deprecated. |
| 311 GaiaAuthHost: Authenticator | 311 GaiaAuthHost: Authenticator |
| 312 }; | 312 }; |
| 313 }); | 313 }); |
| OLD | NEW |