Chromium Code Reviews| Index: extensions/renderer/script_context.h |
| diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h |
| index 4b663670bbd8794055e5eadf47d9b99514bc6040..9a551027d51dd120e4371a8ae1ab41c85989c033 100644 |
| --- a/extensions/renderer/script_context.h |
| +++ b/extensions/renderer/script_context.h |
| @@ -35,7 +35,9 @@ class ScriptContext : public RequestSender::Source, public gin::Runner { |
| ScriptContext(const v8::Handle<v8::Context>& context, |
| blink::WebFrame* frame, |
| const Extension* extension, |
| - Feature::Context context_type); |
| + Feature::Context context_type, |
| + const Extension* effective_extension, |
| + Feature::Context effective_context_type); |
| virtual ~ScriptContext(); |
| // Clears the WebFrame for this contexts and invalidates the associated |
| @@ -52,10 +54,18 @@ class ScriptContext : public RequestSender::Source, public gin::Runner { |
| const Extension* extension() const { return extension_.get(); } |
| + const Extension* effective_extension() const { |
| + return effective_extension_.get(); |
| + } |
| + |
| blink::WebFrame* web_frame() const { return web_frame_; } |
| Feature::Context context_type() const { return context_type_; } |
| + Feature::Context effective_context_type() const { |
| + return effective_context_type_; |
| + } |
| + |
| void set_module_system(scoped_ptr<ModuleSystem> module_system) { |
| module_system_ = module_system.Pass(); |
| } |
| @@ -70,6 +80,10 @@ class ScriptContext : public RequestSender::Source, public gin::Runner { |
| // string if there is no such extension. |
| const std::string& GetExtensionID() const; |
| + // Returns the ID of the effective extension associated with this context, or |
| + // empty string if there is no such extension. |
|
Devlin
2014/09/03 22:09:16
Are all of these accessors really needed? If not
Marijn Kruisselbrink
2014/09/03 23:54:07
Well, it's the "or empty string" part that makes i
|
| + const std::string& GetEffectiveExtensionID() const; |
| + |
| // Returns the RenderView associated with this context. Can return NULL if the |
| // context is in the process of being destroyed. |
| content::RenderView* GetRenderView() const; |
| @@ -95,8 +109,14 @@ class ScriptContext : public RequestSender::Source, public gin::Runner { |
| Feature::Availability GetAvailability(const std::string& api_name); |
| // Returns a string description of the type of context this is. |
|
Devlin
2014/09/03 22:09:16
nit: "...of the |context_type|."
Marijn Kruisselbrink
2014/09/03 23:54:07
Acknowledged.
|
| + static std::string GetContextTypeDescription(Feature::Context context_type); |
| + |
| + // Returns a string description of the type of context this is. |
| std::string GetContextTypeDescription(); |
| + // Returns a string description of the type of context this is. |
|
Devlin
2014/09/03 22:09:16
... of the effective type of context...
Marijn Kruisselbrink
2014/09/03 23:54:07
Done.
|
| + std::string GetEffectiveContextTypeDescription(); |
| + |
| v8::Isolate* isolate() const { return isolate_; } |
| // Get the URL of this context's web frame. |
| @@ -152,6 +172,14 @@ class ScriptContext : public RequestSender::Source, public gin::Runner { |
| // The type of context. |
| Feature::Context context_type_; |
| + // The effective extension associated with this context, or NULL if there is |
| + // none. This is different from the above extension if this context is in an |
| + // about:blank iframe for example. |
| + scoped_refptr<const Extension> effective_extension_; |
| + |
| + // The type of context. |
| + Feature::Context effective_context_type_; |
| + |
| // Owns and structures the JS that is injected to set up extension bindings. |
| scoped_ptr<ModuleSystem> module_system_; |