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 <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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 this.continueUrlWithoutParams_ = | 201 this.continueUrlWithoutParams_ = |
202 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || | 202 this.continueUrl_.substring(0, this.continueUrl_.indexOf('?')) || |
203 this.continueUrl_; | 203 this.continueUrl_; |
204 this.isConstrainedWindow_ = data.constrained == '1'; | 204 this.isConstrainedWindow_ = data.constrained == '1'; |
205 this.isNewGaiaFlowChromeOS = data.isNewGaiaFlowChromeOS; | 205 this.isNewGaiaFlowChromeOS = data.isNewGaiaFlowChromeOS; |
206 this.useEafe_ = data.useEafe || false; | 206 this.useEafe_ = data.useEafe || false; |
207 this.clientId_ = data.clientId; | 207 this.clientId_ = data.clientId; |
208 this.gapsCookie_ = data.gapsCookie; | 208 this.gapsCookie_ = data.gapsCookie; |
209 this.gapsCookieSent_ = false; | 209 this.gapsCookieSent_ = false; |
210 this.newGapsCookie_ = null; | 210 this.newGapsCookie_ = null; |
| 211 this.dontResizeNonEmbeddedPages = data.dontResizeNonEmbeddedPages; |
211 | 212 |
212 this.initialFrameUrl_ = this.constructInitialFrameUrl_(data); | 213 this.initialFrameUrl_ = this.constructInitialFrameUrl_(data); |
213 this.reloadUrl_ = data.frameUrl || this.initialFrameUrl_; | 214 this.reloadUrl_ = data.frameUrl || this.initialFrameUrl_; |
214 // Don't block insecure content for desktop flow because it lands on | 215 // Don't block insecure content for desktop flow because it lands on |
215 // http. Otherwise, block insecure content as long as gaia is https. | 216 // http. Otherwise, block insecure content as long as gaia is https. |
216 this.samlHandler_.blockInsecureContent = authMode != AuthMode.DESKTOP && | 217 this.samlHandler_.blockInsecureContent = authMode != AuthMode.DESKTOP && |
217 this.idpOrigin_.indexOf('https://') == 0; | 218 this.idpOrigin_.indexOf('https://') == 0; |
218 this.needPassword = !('needPassword' in data) || data.needPassword; | 219 this.needPassword = !('needPassword' in data) || data.needPassword; |
219 | 220 |
220 if (this.isNewGaiaFlowChromeOS) { | 221 if (this.isNewGaiaFlowChromeOS) { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 var isEmbeddedPage = false; | 309 var isEmbeddedPage = false; |
309 if (this.idpOrigin_ && currentUrl.lastIndexOf(this.idpOrigin_) == 0) { | 310 if (this.idpOrigin_ && currentUrl.lastIndexOf(this.idpOrigin_) == 0) { |
310 var headers = details.responseHeaders; | 311 var headers = details.responseHeaders; |
311 for (var i = 0; headers && i < headers.length; ++i) { | 312 for (var i = 0; headers && i < headers.length; ++i) { |
312 if (headers[i].name.toLowerCase() == EMBEDDED_FORM_HEADER) { | 313 if (headers[i].name.toLowerCase() == EMBEDDED_FORM_HEADER) { |
313 isEmbeddedPage = true; | 314 isEmbeddedPage = true; |
314 break; | 315 break; |
315 } | 316 } |
316 } | 317 } |
317 } | 318 } |
318 if (!isEmbeddedPage) { | 319 |
| 320 // In some cases, non-embedded pages should not be resized. For |
| 321 // example, on desktop when reauthenticating for purposes of unlocking |
| 322 // a profile, resizing would cause a browser window to open in the |
| 323 // system profile, which is not allowed. |
| 324 if (!isEmbeddedPage && !this.dontResizeNonEmbeddedPages) { |
319 this.dispatchEvent(new CustomEvent('resize', {detail: currentUrl})); | 325 this.dispatchEvent(new CustomEvent('resize', {detail: currentUrl})); |
320 return; | 326 return; |
321 } | 327 } |
322 } | 328 } |
323 | 329 |
324 this.updateHistoryState_(currentUrl); | 330 this.updateHistoryState_(currentUrl); |
325 }; | 331 }; |
326 | 332 |
327 /** | 333 /** |
328 * Manually updates the history. Invoked upon completion of a webview | 334 * Manually updates the history. Invoked upon completion of a webview |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 Authenticator.AuthMode = AuthMode; | 776 Authenticator.AuthMode = AuthMode; |
771 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; | 777 Authenticator.SUPPORTED_PARAMS = SUPPORTED_PARAMS; |
772 | 778 |
773 return { | 779 return { |
774 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old | 780 // TODO(guohui, xiyuan): Rename GaiaAuthHost to Authenticator once the old |
775 // iframe-based flow is deprecated. | 781 // iframe-based flow is deprecated. |
776 GaiaAuthHost: Authenticator, | 782 GaiaAuthHost: Authenticator, |
777 Authenticator: Authenticator | 783 Authenticator: Authenticator |
778 }; | 784 }; |
779 }); | 785 }); |
OLD | NEW |