Chromium Code Reviews| Index: chrome/renderer/extensions/chrome_v8_context.h |
| diff --git a/chrome/renderer/extensions/chrome_v8_context.h b/chrome/renderer/extensions/chrome_v8_context.h |
| index e2c89111dd459bad633e153f860e0b99010fe6a6..2d4ea3a6640d15b961be5e7d646f307d62a28690 100644 |
| --- a/chrome/renderer/extensions/chrome_v8_context.h |
| +++ b/chrome/renderer/extensions/chrome_v8_context.h |
| @@ -30,7 +30,7 @@ class ChromeV8Context { |
| public: |
| ChromeV8Context(v8::Handle<v8::Context> context, |
| WebKit::WebFrame* frame, |
| - const std::string& extension_id, |
| + const Extension* extension, |
|
not at google - send to devlin
2012/04/10 20:42:02
shouldn't this and extension_ be a scoped_refptr?
Aaron Boodman
2012/04/10 21:02:04
scoped_refptr makes me nervous. I prefer to use it
|
| extensions::Feature::Context context_type); |
| ~ChromeV8Context(); |
| @@ -38,8 +38,8 @@ class ChromeV8Context { |
| return v8_context_; |
| } |
| - const std::string& extension_id() const { |
| - return extension_id_; |
| + const Extension* extension() const { |
| + return extension_; |
| } |
| WebKit::WebFrame* web_frame() const { |
| @@ -57,6 +57,10 @@ class ChromeV8Context { |
| module_system_ = module_system.Pass(); |
| } |
| + // Returns the ID of the extension associated with this context, or empty |
| + // string if there is no such extension. |
| + std::string GetExtensionID(); |
| + |
| // Returns a special Chrome-specific hidden object that is associated with a |
| // context, but not reachable from the JavaScript in that context. This is |
| // used by our v8::Extension implementations as a way to share code and as a |
| @@ -77,8 +81,8 @@ class ChromeV8Context { |
| // TODO(aa): Move this to EventBindings. |
| void DispatchOnLoadEvent(bool is_extension_process, |
| bool is_incognito_process, |
| - int manifest_version) const; |
| - void DispatchOnUnloadEvent() const; |
| + int manifest_version); |
| + void DispatchOnUnloadEvent(); |
| // Call the named method of the chromeHidden object in this context. |
| // The function can be a sub-property like "Port.dispatchOnMessage". Returns |
| @@ -90,6 +94,10 @@ class ChromeV8Context { |
| v8::Handle<v8::Value>* argv, |
| v8::Handle<v8::Value>* result) const; |
| + // Returns the set of extension APIs that are available to this context. If no |
| + // APIs are available, returns an empty set, not NULL. |
|
not at google - send to devlin
2012/04/10 20:42:02
Return a const pointer?
Or even a reference, if i
Aaron Boodman
2012/04/10 21:02:04
Good idea. Dizzone.
|
| + std::set<std::string>* GetAvailableExtensionAPIs(); |
| + |
| private: |
| // The v8 context the bindings are accessible to. We keep a strong reference |
| // to it for simplicity. In the case of content scripts, this is necessary |
| @@ -104,8 +112,9 @@ class ChromeV8Context { |
| // object can outlive is destroyed asynchronously. |
| WebKit::WebFrame* web_frame_; |
| - // The extension ID this context is associated with. |
| - std::string extension_id_; |
| + // The extension associated with this context, or NULL if there is none. This |
| + // might be a hosted app in the case that this context is hosting a web URL. |
| + const Extension* extension_; |
| // The type of context. |
| extensions::Feature::Context context_type_; |
| @@ -113,6 +122,9 @@ class ChromeV8Context { |
| // Owns and structures the JS that is injected to set up extension bindings. |
| scoped_ptr<ModuleSystem> module_system_; |
| + // The extension APIs available to this context. |
| + scoped_ptr<std::set<std::string> > available_extension_apis_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ChromeV8Context); |
| }; |