| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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="post_message_channel.js"> | 5 <include src="post_message_channel.js"> |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @fileoverview Saml support for webview based auth. | 8 * @fileoverview Saml support for webview based auth. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 */ | 141 */ |
| 142 this.blockInsecureContent = false; | 142 this.blockInsecureContent = false; |
| 143 | 143 |
| 144 this.webview_.addEventListener( | 144 this.webview_.addEventListener( |
| 145 'contentload', this.onContentLoad_.bind(this)); | 145 'contentload', this.onContentLoad_.bind(this)); |
| 146 this.webview_.addEventListener( | 146 this.webview_.addEventListener( |
| 147 'loadabort', this.onLoadAbort_.bind(this)); | 147 'loadabort', this.onLoadAbort_.bind(this)); |
| 148 this.webview_.addEventListener( | 148 this.webview_.addEventListener( |
| 149 'loadcommit', this.onLoadCommit_.bind(this)); | 149 'loadcommit', this.onLoadCommit_.bind(this)); |
| 150 this.webview_.addEventListener( | 150 this.webview_.addEventListener( |
| 151 'permissionrequest', function(e) { | 151 'permissionrequest', this.onPermissionRequest_.bind(this)); |
| 152 if (e.permission === 'media') { | |
| 153 // The actual permission check happens in | |
| 154 // WebUILoginView::RequestMediaAccessPermission(). | |
| 155 e.request.allow(); | |
| 156 } | |
| 157 }); | |
| 158 | 152 |
| 159 this.webview_.request.onBeforeRequest.addListener( | 153 this.webview_.request.onBeforeRequest.addListener( |
| 160 this.onInsecureRequest.bind(this), | 154 this.onInsecureRequest.bind(this), |
| 161 {urls: ['http://*/*', 'file://*/*', 'ftp://*/*']}, | 155 {urls: ['http://*/*', 'file://*/*', 'ftp://*/*']}, |
| 162 ['blocking']); | 156 ['blocking']); |
| 163 this.webview_.request.onHeadersReceived.addListener( | 157 this.webview_.request.onHeadersReceived.addListener( |
| 164 this.onHeadersReceived_.bind(this), | 158 this.onHeadersReceived_.bind(this), |
| 165 {urls: ['<all_urls>'], types: ['main_frame', 'xmlhttprequest']}, | 159 {urls: ['<all_urls>'], types: ['main_frame', 'xmlhttprequest']}, |
| 166 ['blocking', 'responseHeaders']); | 160 ['blocking', 'responseHeaders']); |
| 167 | 161 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 446 |
| 453 onPageLoaded_: function(channel, msg) { | 447 onPageLoaded_: function(channel, msg) { |
| 454 this.authDomain = extractDomain(msg.url); | 448 this.authDomain = extractDomain(msg.url); |
| 455 this.dispatchEvent(new CustomEvent( | 449 this.dispatchEvent(new CustomEvent( |
| 456 'authPageLoaded', | 450 'authPageLoaded', |
| 457 {detail: {url: url, | 451 {detail: {url: url, |
| 458 isSAMLPage: this.isSamlPage_, | 452 isSAMLPage: this.isSamlPage_, |
| 459 domain: this.authDomain}})); | 453 domain: this.authDomain}})); |
| 460 }, | 454 }, |
| 461 | 455 |
| 456 onPermissionRequest_: function(permissionEvent) { |
| 457 if (permissionEvent.permission === 'media') { |
| 458 // The actual permission check happens in |
| 459 // WebUILoginView::RequestMediaAccessPermission(). |
| 460 this.dispatchEvent(new CustomEvent('videoEnabled')); |
| 461 permissionEvent.request.allow(); |
| 462 } |
| 463 }, |
| 464 |
| 462 onGetSAMLFlag_: function(channel, msg) { | 465 onGetSAMLFlag_: function(channel, msg) { |
| 463 return this.isSamlPage_; | 466 return this.isSamlPage_; |
| 464 }, | 467 }, |
| 465 }; | 468 }; |
| 466 | 469 |
| 467 return { | 470 return { |
| 468 SamlHandler: SamlHandler | 471 SamlHandler: SamlHandler |
| 469 }; | 472 }; |
| 470 }); | 473 }); |
| OLD | NEW |