Allow content script insertion on about:-URLs.
Adds a new key content_scripts[*].match_about_blank and
InjectionDetails.matchAboutBlank.
If true, content scripts will also be inserted in about:* frames
provided that its origin matches a pattern in the extension permissions.
BUG=76429,55084,146789
TEST=browser_tests: ExtensionApiTest.ContentScriptAboutBlank*:ScriptContextTest.GetEffectiveDocumentURL
Review URL: https://codereview.chromium.org/226663003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270690 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h
index 5cc137e..d5f1ae1 100644
--- a/extensions/renderer/script_context.h
+++ b/extensions/renderer/script_context.h
@@ -105,6 +105,13 @@
// committed, this is the commited URL. Otherwise it is the provisional URL.
static GURL GetDataSourceURLForFrame(const blink::WebFrame* frame);
+ // Returns the first non-about:-URL in the document hierarchy above and
+ // including |frame|. The document hierarchy is only traversed if
+ // |document_url| is an about:-URL and if |match_about_blank| is true.
+ static GURL GetEffectiveDocumentURL(const blink::WebFrame* frame,
+ const GURL& document_url,
+ bool match_about_blank);
+
// RequestSender::Source implementation.
virtual ScriptContext* GetContext() OVERRIDE;
virtual void OnResponseReceived(const std::string& name,