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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 }; | 325 }; |
326 | 326 |
327 /** | 327 /** |
328 * Invoked when a new document is loaded. | 328 * Invoked when a new document is loaded. |
329 * @private | 329 * @private |
330 */ | 330 */ |
331 Authenticator.prototype.onContentLoad_ = function(e) { | 331 Authenticator.prototype.onContentLoad_ = function(e) { |
332 // Posts a message to IdP pages to initiate communication. | 332 // Posts a message to IdP pages to initiate communication. |
333 var currentUrl = this.webview_.src; | 333 var currentUrl = this.webview_.src; |
334 if (currentUrl.lastIndexOf(this.idpOrigin_) == 0) { | 334 if (currentUrl.lastIndexOf(this.idpOrigin_) == 0) { |
335 this.webview_.contentWindow.postMessage({}, currentUrl); | 335 var msg = { |
| 336 'method': 'handshake' |
| 337 }; |
| 338 this.webview_.contentWindow.postMessage(msg, currentUrl); |
336 } | 339 } |
337 }; | 340 }; |
338 | 341 |
339 /** | 342 /** |
340 * Invoked when the webview finishes loading a page. | 343 * Invoked when the webview finishes loading a page. |
341 * @private | 344 * @private |
342 */ | 345 */ |
343 Authenticator.prototype.onLoadStop_ = function(e) { | 346 Authenticator.prototype.onLoadStop_ = function(e) { |
344 if (!this.loaded_) { | 347 if (!this.loaded_) { |
345 this.loaded_ = true; | 348 this.loaded_ = true; |
(...skipping 20 matching lines...) Expand all Loading... |
366 Authenticator.AuthFlow = AuthFlow; | 369 Authenticator.AuthFlow = AuthFlow; |
367 Authenticator.AuthMode = AuthMode; | 370 Authenticator.AuthMode = AuthMode; |
368 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 371 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
369 | 372 |
370 return { | 373 return { |
371 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 374 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
372 // iframe-based flow is deprecated. | 375 // iframe-based flow is deprecated. |
373 GaiaAuthHost: Authenticator | 376 GaiaAuthHost: Authenticator |
374 }; | 377 }; |
375 }); | 378 }); |
OLD | NEW |