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

Unified Diff: chrome/browser/resources/gaia_auth_host/saml_handler.js

Issue 1066573003: cros: Use webview.addContentScripts for new Gaia SAML. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webview-content-script-incognito
Patch Set: rebase Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
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
};

Powered by Google App Engine
This is Rietveld 408576698