| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 this.skipForNow_ = false; | 84 this.skipForNow_ = false; |
| 85 this.authFlow_ = AuthFlow.DEFAULT; | 85 this.authFlow_ = AuthFlow.DEFAULT; |
| 86 this.loaded_ = false; | 86 this.loaded_ = false; |
| 87 this.idpOrigin_ = null; | 87 this.idpOrigin_ = null; |
| 88 this.continueUrl_ = null; | 88 this.continueUrl_ = null; |
| 89 this.continueUrlWithoutParams_ = null; | 89 this.continueUrlWithoutParams_ = null; |
| 90 this.initialFrameUrl_ = null; | 90 this.initialFrameUrl_ = null; |
| 91 this.reloadUrl_ = null; | 91 this.reloadUrl_ = null; |
| 92 this.trusted_ = true; | 92 this.trusted_ = true; |
| 93 | 93 |
| 94 this.webview_.addEventListener('drop', this.onDrop_.bind(this)); | 94 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); |
| 95 this.webview_.addEventListener( | 95 this.webview_.addEventListener( |
| 96 'newwindow', this.onNewWindow_.bind(this)); | 96 'newwindow', this.onNewWindow_.bind(this)); |
| 97 this.webview_.addEventListener( | 97 this.webview_.addEventListener( |
| 98 'contentload', this.onContentLoad_.bind(this)); | 98 'contentload', this.onContentLoad_.bind(this)); |
| 99 this.webview_.addEventListener( | 99 this.webview_.addEventListener( |
| 100 'loadstop', this.onLoadStop_.bind(this)); | 100 'loadstop', this.onLoadStop_.bind(this)); |
| 101 this.webview_.addEventListener( | 101 this.webview_.addEventListener( |
| 102 'loadcommit', this.onLoadCommit_.bind(this)); | 102 'loadcommit', this.onLoadCommit_.bind(this)); |
| 103 this.webview_.request.onCompleted.addListener( | 103 this.webview_.request.onCompleted.addListener( |
| 104 this.onRequestCompleted_.bind(this), | 104 this.onRequestCompleted_.bind(this), |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 gaiaId: this.gaiaId_ || '', | 328 gaiaId: this.gaiaId_ || '', |
| 329 password: this.password_ || '', | 329 password: this.password_ || '', |
| 330 usingSAML: this.authFlow_ == AuthFlow.SAML, | 330 usingSAML: this.authFlow_ == AuthFlow.SAML, |
| 331 chooseWhatToSync: this.chooseWhatToSync_, | 331 chooseWhatToSync: this.chooseWhatToSync_, |
| 332 skipForNow: this.skipForNow_, | 332 skipForNow: this.skipForNow_, |
| 333 sessionIndex: this.sessionIndex_ || '', | 333 sessionIndex: this.sessionIndex_ || '', |
| 334 trusted: this.trusted_}})); | 334 trusted: this.trusted_}})); |
| 335 }; | 335 }; |
| 336 | 336 |
| 337 /** | 337 /** |
| 338 * Invoked at the drop phase of a drag-and-drop operation on the webview. | 338 * Invoked when a link is dropped on the webview. |
| 339 * @private | 339 * @private |
| 340 */ | 340 */ |
| 341 Authenticator.prototype.onDrop_ = function(e) { | 341 Authenticator.prototype.onDropLink_ = function(e) { |
| 342 var url = e.dataTransfer.getData('url'); | 342 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); |
| 343 if (url) | |
| 344 this.dispatchEvent(new CustomEvent('dropLink', {detail: url})); | |
| 345 }; | 343 }; |
| 346 | 344 |
| 347 /** | 345 /** |
| 348 * Invoked when the webview attempts to open a new window. | 346 * Invoked when the webview attempts to open a new window. |
| 349 * @private | 347 * @private |
| 350 */ | 348 */ |
| 351 Authenticator.prototype.onNewWindow_ = function(e) { | 349 Authenticator.prototype.onNewWindow_ = function(e) { |
| 352 this.dispatchEvent(new CustomEvent('newWindow', {detail: e})); | 350 this.dispatchEvent(new CustomEvent('newWindow', {detail: e})); |
| 353 }; | 351 }; |
| 354 | 352 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 Authenticator.AuthFlow = AuthFlow; | 395 Authenticator.AuthFlow = AuthFlow; |
| 398 Authenticator.AuthMode = AuthMode; | 396 Authenticator.AuthMode = AuthMode; |
| 399 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 397 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
| 400 | 398 |
| 401 return { | 399 return { |
| 402 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 400 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
| 403 // iframe-based flow is deprecated. | 401 // iframe-based flow is deprecated. |
| 404 GaiaAuthHost: Authenticator | 402 GaiaAuthHost: Authenticator |
| 405 }; | 403 }; |
| 406 }); | 404 }); |
| OLD | NEW |