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

Unified Diff: extensions/renderer/script_injection.h

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/programmatic_script_injector.cc ('k') | extensions/renderer/script_injection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/script_injection.h
diff --git a/extensions/renderer/script_injection.h b/extensions/renderer/script_injection.h
index d7edd666165ec3d3ed1c21f12557287748c20899..d28780f520567de1ed894dfa9e74b01107b9e02a 100644
--- a/extensions/renderer/script_injection.h
+++ b/extensions/renderer/script_injection.h
@@ -10,27 +10,29 @@
#include "extensions/common/user_script.h"
#include "extensions/renderer/script_injector.h"
+class InjectionHost;
+struct HostID;
+
namespace blink {
class WebLocalFrame;
}
namespace extensions {
-class Extension;
struct ScriptsRunInfo;
// A script wrapper which is aware of whether or not it is allowed to execute,
// and contains the implementation to do so.
class ScriptInjection {
public:
- // Return the id of the extension associated with the given world.
- static std::string GetExtensionIdForIsolatedWorld(int world_id);
+ // Return the id of the injection host associated with the given world.
+ static std::string GetHostIdForIsolatedWorld(int world_id);
- // Remove the isolated world associated with the given extension.
- static void RemoveIsolatedWorld(const std::string& extension_id);
+ // Remove the isolated world associated with the given injection host.
+ static void RemoveIsolatedWorld(const std::string& host_id);
ScriptInjection(scoped_ptr<ScriptInjector> injector,
blink::WebLocalFrame* web_frame,
- const std::string& extension_id,
+ const HostID& host_id,
UserScript::RunLocation run_location,
int tab_id);
~ScriptInjection();
@@ -39,19 +41,19 @@ class ScriptInjection {
// the script has either injected or will never inject (i.e., if the object
// is done), and false if injection is delayed (either for permission purposes
// or because |current_location| is not the designated |run_location_|).
- // NOTE: |extension| may be NULL, if the extension is removed!
+ // NOTE: |injection_host| may be NULL, if the injection_host is removed!
bool TryToInject(UserScript::RunLocation current_location,
- const Extension* extension,
+ const InjectionHost* injection_host,
ScriptsRunInfo* scripts_run_info);
// Called when permission for the given injection has been granted.
// Returns true if the injection ran.
- bool OnPermissionGranted(const Extension* extension,
+ bool OnPermissionGranted(const InjectionHost* injection_host,
ScriptsRunInfo* scripts_run_info);
// Accessors.
blink::WebLocalFrame* web_frame() const { return web_frame_; }
- const std::string& extension_id() const { return extension_id_; }
+ const HostID& host_id() const { return host_id_; }
int64 request_id() const { return request_id_; }
private:
@@ -59,11 +61,12 @@ class ScriptInjection {
void RequestPermission();
// Injects the script, optionally populating |scripts_run_info|.
- void Inject(const Extension* extension, ScriptsRunInfo* scripts_run_info);
+ void Inject(const InjectionHost* injection_host,
+ ScriptsRunInfo* scripts_run_info);
// Inject any JS scripts into the |frame|, optionally populating
// |execution_results|.
- void InjectJs(const Extension* extension,
+ void InjectJs(const InjectionHost* injection_host,
blink::WebLocalFrame* frame,
base::ListValue* execution_results);
@@ -79,8 +82,8 @@ class ScriptInjection {
// The (main) WebFrame into which this should inject the script.
blink::WebLocalFrame* web_frame_;
- // The id of the associated extension.
- std::string extension_id_;
+ // The id of the associated injection_host.
+ HostID host_id_;
// The location in the document load at which we inject the script.
UserScript::RunLocation run_location_;
« no previous file with comments | « extensions/renderer/programmatic_script_injector.cc ('k') | extensions/renderer/script_injection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698