Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Side by Side Diff: chrome/browser/resources/gaia_auth_host/authenticator.js

Issue 2380203002: cros: Fix API 'add' password and complete auth racing (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth_host/saml_handler.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <include src="saml_handler.js"> 5 <include src="saml_handler.js">
6 6
7 /** 7 /**
8 * @fileoverview An UI component to authenciate to Chrome. The component hosts 8 * @fileoverview An UI component to authenciate to Chrome. The component hosts
9 * IdP web pages in a webview. A client who is interested in monitoring 9 * IdP web pages in a webview. A client who is interested in monitoring
10 * authentication events should pass a listener object of type 10 * authentication events should pass a listener object of type
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 this.needPassword = true; 156 this.needPassword = true;
157 this.samlHandler_.addEventListener( 157 this.samlHandler_.addEventListener(
158 'insecureContentBlocked', 158 'insecureContentBlocked',
159 this.onInsecureContentBlocked_.bind(this)); 159 this.onInsecureContentBlocked_.bind(this));
160 this.samlHandler_.addEventListener( 160 this.samlHandler_.addEventListener(
161 'authPageLoaded', 161 'authPageLoaded',
162 this.onAuthPageLoaded_.bind(this)); 162 this.onAuthPageLoaded_.bind(this));
163 this.samlHandler_.addEventListener( 163 this.samlHandler_.addEventListener(
164 'videoEnabled', 164 'videoEnabled',
165 this.onVideoEnabled_.bind(this)); 165 this.onVideoEnabled_.bind(this));
166 this.samlHandler_.addEventListener(
167 'apiPasswordAdded',
168 this.onSamlApiPasswordAdded_.bind(this));
166 169
167 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this)); 170 this.webview_.addEventListener('droplink', this.onDropLink_.bind(this));
168 this.webview_.addEventListener( 171 this.webview_.addEventListener(
169 'newwindow', this.onNewWindow_.bind(this)); 172 'newwindow', this.onNewWindow_.bind(this));
170 this.webview_.addEventListener( 173 this.webview_.addEventListener(
171 'contentload', this.onContentLoad_.bind(this)); 174 'contentload', this.onContentLoad_.bind(this));
172 this.webview_.addEventListener( 175 this.webview_.addEventListener(
173 'loadabort', this.onLoadAbort_.bind(this)); 176 'loadabort', this.onLoadAbort_.bind(this));
174 this.webview_.addEventListener( 177 this.webview_.addEventListener(
175 'loadstop', this.onLoadStop_.bind(this)); 178 'loadstop', this.onLoadStop_.bind(this));
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 751
749 /** 752 /**
750 * Invoked when |samlHandler_| fires 'videoEnabled' event. 753 * Invoked when |samlHandler_| fires 'videoEnabled' event.
751 * @private 754 * @private
752 */ 755 */
753 Authenticator.prototype.onVideoEnabled_ = function(e) { 756 Authenticator.prototype.onVideoEnabled_ = function(e) {
754 this.videoEnabled = true; 757 this.videoEnabled = true;
755 }; 758 };
756 759
757 /** 760 /**
761 * Invoked when |samlHandler_| fires 'apiPasswordAdded' event.
762 * @private
763 */
764 Authenticator.prototype.onSamlApiPasswordAdded_ = function(e) {
765 // Saml API 'add' password might be received after the 'loadcommit' event.
766 // In such case, maybeCompleteAuth_ should be attempted again if oauth code
767 // is available.
768 if (this.oauthCode_)
769 this.maybeCompleteAuth_();
770 };
771
772 /**
758 * Invoked when a link is dropped on the webview. 773 * Invoked when a link is dropped on the webview.
759 * @private 774 * @private
760 */ 775 */
761 Authenticator.prototype.onDropLink_ = function(e) { 776 Authenticator.prototype.onDropLink_ = function(e) {
762 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url})); 777 this.dispatchEvent(new CustomEvent('dropLink', {detail: e.url}));
763 }; 778 };
764 779
765 /** 780 /**
766 * Invoked when the webview attempts to open a new window. 781 * Invoked when the webview attempts to open a new window.
767 * @private 782 * @private
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 Authenticator.AuthMode = AuthMode; 888 Authenticator.AuthMode = AuthMode;
874 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; 889 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS;
875 890
876 return { 891 return {
877 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old 892 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old
878 // iframe-based flow is deprecated. 893 // iframe-based flow is deprecated.
879 GaiaAuthHost: Authenticator, 894 GaiaAuthHost: Authenticator,
880 Authenticator: Authenticator 895 Authenticator: Authenticator
881 }; 896 };
882 }); 897 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/gaia_auth_host/saml_handler.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698