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 906493004: 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: Rebase and remove ConsumerInstanceInfo(id). 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 c3e15ef36e909c4a9cd0ec3568f226e1ce252587..c2dd25be9b984a35470941f76d66e4012cf3ebf1 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -8,6 +8,7 @@
#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"
@@ -132,6 +133,13 @@ PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
if (tab_id == -1)
return PermissionsData::ACCESS_ALLOWED;
+ int routing_id = content::RenderView::FromWebView(web_frame->top()->view())
+ ->GetRoutingID();
+ if (script_->routing_info().render_view_id == routing_id &&
Devlin 2015/02/23 20:15:00 Should this just work with the injection host call
Xi Han 2015/02/24 16:19:55 It seems in current implementation, all webview re
Devlin 2015/02/25 17:14:38 While that's true, the reason all webview logic is
Xi Han 2015/02/27 19:36:19 As discussed offline, leave the ScriptInjector::Ca
+ script_->consumer_instance_type() ==
+ UserScript::ConsumerInstanceType::WEBVIEW)
+ return PermissionsData::ACCESS_ALLOWED;
+
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
web_frame, web_frame->document().url(), script_->match_about_blank());
return injection_host->CanExecuteOnFrame(

Powered by Google App Engine
This is Rietveld 408576698