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

Unified Diff: extensions/renderer/script_injector.h

Issue 2213603002: Prevent duplicate content script injection defined in manifest.json (reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed patch 7 code review comments Created 4 years, 3 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/script_injector.h
diff --git a/extensions/renderer/script_injector.h b/extensions/renderer/script_injector.h
index 0ed69f73d2a6e12a5cf6200a6d3214936b5c5d65..ddb6291af46acdf1fe10e10cb028f9409ccdc3c2 100644
--- a/extensions/renderer/script_injector.h
+++ b/extensions/renderer/script_injector.h
@@ -51,10 +51,14 @@ class ScriptInjector {
// Returns true if the script should inject JS source at the given
// |run_location|.
- virtual bool ShouldInjectJs(UserScript::RunLocation run_location) const = 0;
+ virtual bool ShouldInjectJs(UserScript::RunLocation run_location,
+ std::map<std::string, std::set<std::string>>&
+ executing_scripts) const = 0;
// Returns true if the script should inject CSS at the given |run_location|.
- virtual bool ShouldInjectCss(UserScript::RunLocation run_location) const = 0;
+ virtual bool ShouldInjectCss(UserScript::RunLocation run_location,
+ std::map<std::string, std::set<std::string>>&
+ executing_scripts) const = 0;
// Returns true if the script should execute on the given |frame|.
virtual PermissionsData::AccessType CanExecuteOnFrame(
@@ -65,17 +69,16 @@ class ScriptInjector {
// Returns the javascript sources to inject at the given |run_location|.
// Only called if ShouldInjectJs() is true.
virtual std::vector<blink::WebScriptSource> GetJsSources(
- UserScript::RunLocation run_location) const = 0;
+ UserScript::RunLocation run_location,
+ std::map<std::string, std::set<std::string>>* executing_scripts,
+ size_t* num_injected_js_scripts) const = 0;
// Returns the css to inject at the given |run_location|.
// Only called if ShouldInjectCss() is true.
virtual std::vector<blink::WebString> GetCssSources(
- UserScript::RunLocation run_location) const = 0;
-
- // Fill scriptrs run info based on information about injection.
- virtual void GetRunInfo(
- ScriptsRunInfo* scripts_run_info,
- UserScript::RunLocation run_location) const = 0;
+ UserScript::RunLocation run_location,
+ std::map<std::string, std::set<std::string>>* executing_scripts,
+ size_t* num_injected_css_scripts) const = 0;
Devlin 2016/09/06 17:21:13 "scripts" here is a little misleading (css isn't a
catmullings 2016/09/07 01:00:35 Done.
// Notifies the script that injection has completed, with a possibly-populated
// list of results (depending on whether or not ExpectsResults() was true).

Powered by Google App Engine
This is Rietveld 408576698