| Index: extensions/renderer/script_injection.h
|
| diff --git a/extensions/renderer/script_injection.h b/extensions/renderer/script_injection.h
|
| index d7edd666165ec3d3ed1c21f12557287748c20899..f3a575b705de85ca3539f2000a365085873c7d4c 100644
|
| --- a/extensions/renderer/script_injection.h
|
| +++ b/extensions/renderer/script_injection.h
|
| @@ -7,6 +7,7 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/macros.h"
|
| +#include "extensions/common/host_id.h"
|
| #include "extensions/common/user_script.h"
|
| #include "extensions/renderer/script_injector.h"
|
|
|
| @@ -15,22 +16,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 HostID& 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 +40,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 +60,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 +80,13 @@ 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 number.
|
| + int instance_id_;
|
|
|
| // The location in the document load at which we inject the script.
|
| UserScript::RunLocation run_location_;
|
|
|