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

Unified Diff: extensions/renderer/user_script_injector.cc

Issue 972863002: Revert of Refactoring: de-couple Extensions from "script injection System" [render side]:2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_1
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/extension_injection_host.cc ('k') | no next file » | 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 e620a7c65e4ec79b361e9735aa4d4e7b70919a4f..c3e15ef36e909c4a9cd0ec3568f226e1ce252587 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -8,7 +8,6 @@
#include "base/lazy_instance.h"
#include "content/public/common/url_constants.h"
-#include "content/public/renderer/render_view.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/renderer/injection_host.h"
@@ -128,21 +127,15 @@
blink::WebFrame* web_frame,
int tab_id,
const GURL& top_url) const {
+ // If we don't have a tab id, we have no UI surface to ask for user consent.
+ // For now, we treat this as an automatic allow.
+ if (tab_id == -1)
+ return PermissionsData::ACCESS_ALLOWED;
+
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
web_frame, web_frame->document().url(), script_->match_about_blank());
- PermissionsData::AccessType can_execute = injection_host->CanExecuteOnFrame(
+ return injection_host->CanExecuteOnFrame(
effective_document_url, top_url, tab_id, is_declarative_);
-
- if (script_->consumer_instance_type() !=
- UserScript::ConsumerInstanceType::WEBVIEW ||
- can_execute == PermissionsData::ACCESS_DENIED)
- return can_execute;
-
- int routing_id = content::RenderView::FromWebView(web_frame->top()->view())
- ->GetRoutingID();
- return script_->routing_info().render_view_id == routing_id
- ? PermissionsData::ACCESS_ALLOWED
- : PermissionsData::ACCESS_DENIED;
}
std::vector<blink::WebScriptSource> UserScriptInjector::GetJsSources(
« no previous file with comments | « extensions/renderer/extension_injection_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698