Index: chrome/browser/resources/gaia_auth_host/saml_handler.js |
diff --git a/chrome/browser/resources/gaia_auth_host/saml_handler.js b/chrome/browser/resources/gaia_auth_host/saml_handler.js |
index b41fad8597fba418cf855a61c5566cebc8ad5e72..bf6db2dfc357052030007a5345d966ea343a8686 100644 |
--- a/chrome/browser/resources/gaia_auth_host/saml_handler.js |
+++ b/chrome/browser/resources/gaia_auth_host/saml_handler.js |
@@ -157,6 +157,14 @@ cr.define('cr.login', function() { |
{urls: ['<all_urls>'], types: ['main_frame', 'xmlhttprequest']}, |
['blocking', 'responseHeaders']); |
+ this.webview_.addContentScripts([{ |
+ 'name': 'samlInjected', |
+ 'matches': ['http://*/*', 'https://*/*'], |
+ 'code': injectedJs, |
+ 'all_frames': true, |
+ 'run_at': 'document_start' |
+ }]); |
+ |
PostMessageChannel.runAsDaemon(this.onConnected_.bind(this)); |
} |
@@ -223,22 +231,6 @@ cr.define('cr.login', function() { |
}, |
/** |
- * Injects JS code to all frames. |
- * @private |
- */ |
- injectJs_: function() { |
- if (!injectedJs) |
- return; |
- |
- // TODO(xiyuan): Replace this with webview.addContentScript. |
- this.webview_.executeScript({ |
- code: injectedJs, |
- allFrames: true, |
- runAt: 'document_start' |
- }); |
- }, |
- |
- /** |
* Invoked on the webview's contentload event. |
* @private |
*/ |
@@ -273,7 +265,6 @@ cr.define('cr.login', function() { |
} |
this.isSamlPage_ = this.pendingIsSamlPage_; |
- this.injectJs_(); |
}, |
/** |
@@ -454,14 +445,6 @@ cr.define('cr.login', function() { |
}, |
}; |
- /** |
- * Sets the saml injected JS code. |
- * @param {string} samlInjectedJs JS code to inejct for Saml. |
- */ |
- SamlHandler.setSamlInjectedJs = function(samlInjectedJs) { |
- injectedJs = samlInjectedJs; |
- }; |
- |
return { |
SamlHandler: SamlHandler |
}; |