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

Unified Diff: extensions/renderer/user_script_injector.cc

Issue 348313003: Create withheld permissions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master Created 6 years, 5 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 6e4497f8f5799b0f85a418392a23c6f1db1b3c56..79361557d869f80a3bbc25321d039f8a4f696cab 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -87,6 +87,10 @@ void UserScriptInjector::OnUserScriptsUpdated(
}
}
+UserScript::InjectionType UserScriptInjector::script_type() const {
+ return UserScript::CONTENT_SCRIPT;
+}
+
bool UserScriptInjector::ShouldExecuteInChildFrames() const {
return false;
}
@@ -115,7 +119,7 @@ bool UserScriptInjector::ShouldInjectCss(
!script_->css_scripts().empty();
}
-ScriptInjector::AccessType UserScriptInjector::CanExecuteOnFrame(
+PermissionsData::AccessType UserScriptInjector::CanExecuteOnFrame(
const Extension* extension,
blink::WebFrame* web_frame,
int tab_id,
@@ -123,15 +127,18 @@ ScriptInjector::AccessType UserScriptInjector::CanExecuteOnFrame(
// 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 ALLOW_ACCESS;
+ return PermissionsData::ACCESS_ALLOWED;
GURL effective_document_url = ScriptContext::GetEffectiveDocumentURL(
web_frame, web_frame->document().url(), script_->match_about_blank());
- return extension->permissions_data()->RequiresActionForScriptExecution(
- extension, tab_id, web_frame->top()->document().url())
- ? REQUEST_ACCESS
- : ALLOW_ACCESS;
+ return extension->permissions_data()->GetContentScriptAccess(
+ extension,
+ effective_document_url,
+ top_url,
+ tab_id,
+ -1, // no process id
+ NULL /* ignore error */);
}
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