Chromium Code Reviews| Index: extensions/renderer/script_injection.h |
| diff --git a/extensions/renderer/script_injection.h b/extensions/renderer/script_injection.h |
| index d7edd666165ec3d3ed1c21f12557287748c20899..9300a4c64ca429a4e65fc82bf77956944a9512b7 100644 |
| --- a/extensions/renderer/script_injection.h |
| +++ b/extensions/renderer/script_injection.h |
| @@ -15,22 +15,22 @@ 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 host associated with the given world. |
| + static HostID 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 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, |
| + int instance_id, |
| UserScript::RunLocation run_location, |
| int tab_id); |
| ~ScriptInjection(); |
| @@ -39,19 +39,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: |host| may be NULL, if the host is removed! |
| bool TryToInject(UserScript::RunLocation current_location, |
| - const Extension* extension, |
| + const Host* 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 Host* 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 +59,11 @@ class ScriptInjection { |
| void RequestPermission(); |
| // Injects the script, optionally populating |scripts_run_info|. |
| - void Inject(const Extension* extension, ScriptsRunInfo* scripts_run_info); |
| + void Inject(const Host* host, ScriptsRunInfo* scripts_run_info); |
| // Inject any JS scripts into the |frame|, optionally populating |
| // |execution_results|. |
| - void InjectJs(const Extension* extension, |
| + void InjectJs(const Host* host, |
| blink::WebLocalFrame* frame, |
| base::ListValue* execution_results); |
| @@ -79,8 +79,14 @@ 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 host. |
| + HostID host_id_; |
| + |
| + // The id of the instance on which the host will inject the script. |
| + // If the instance is a regular tab, the |instance_id| is 0; |
| + // If the instance is a <webview>, the |instance_id| is a unique positive |
|
Devlin
2015/02/04 17:01:14
nit: lowercase "if" and fix line wrapping.
Xi Han
2015/02/05 16:06:20
Done.
|
| + // number. |
| + int instance_id_; |
| // The location in the document load at which we inject the script. |
| UserScript::RunLocation run_location_; |