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

Unified Diff: extensions/renderer/user_script_injector.cc

Issue 885493007: Refactoring: de-couple Extensions from "script injection System" [render side] : 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove Host::IsEmpty() and move ExtensionConsumer to extensions/renderer. Created 5 years, 10 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: extensions/renderer/user_script_injector.cc
diff --git a/extensions/renderer/user_script_injector.cc b/extensions/renderer/user_script_injector.cc
index 73ac9f60a839a44787e079db87d84a7847e8bf24..0d7a47041632f98b9a971124752e87adefc9c36b 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -122,7 +122,7 @@ bool UserScriptInjector::ShouldInjectCss(
}
PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
- const Extension* extension,
+ const Host* host,
blink::WebFrame* web_frame,
int tab_id,
const GURL& top_url) const {
@@ -133,27 +133,8 @@ PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
web_frame, web_frame->document().url(), script_->match_about_blank());
-
- // Declarative user scripts use "page access" (from "permissions" section in
- // manifest) whereas non-declarative user scripts use custom
- // "content script access" logic.
- if (is_declarative_) {
- return extension->permissions_data()->GetPageAccess(
- extension,
- effective_document_url,
- top_url,
- tab_id,
- -1, // no process id
- NULL /* ignore error */);
- } else {
- return extension->permissions_data()->GetContentScriptAccess(
- extension,
- effective_document_url,
- top_url,
- tab_id,
- -1, // no process id
- NULL /* ignore error */);
- }
+ return host->CanExecuteOnFrame(
+ effective_document_url, top_url, tab_id, is_declarative_);
}
std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources(

Powered by Google App Engine
This is Rietveld 408576698