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

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: 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
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c3e15ef36e909c4a9cd0ec3568f226e1ce252587 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -10,6 +10,7 @@
#include "content/public/common/url_constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permissions_data.h"
+#include "extensions/renderer/injection_host.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/scripts_run_info.h"
#include "grit/extensions_renderer_resources.h"
@@ -122,7 +123,7 @@ bool UserScriptInjector::ShouldInjectCss(
}
PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
- const Extension* extension,
+ const InjectionHost* injection_host,
blink::WebFrame* web_frame,
int tab_id,
const GURL& top_url) const {
@@ -133,27 +134,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 injection_host->CanExecuteOnFrame(
+ effective_document_url, top_url, tab_id, is_declarative_);
}
std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources(
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | extensions/renderer/user_script_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698