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

Unified Diff: chrome/renderer/extensions/chrome_v8_context.h

Issue 10024055: Remove unneeded extension_messages_browsertest.cc + cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windoooowze Created 8 years, 8 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 | « chrome/renderer/extensions/app_bindings.cc ('k') | chrome/renderer/extensions/chrome_v8_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e49b638fe08dbbdd4702e8e248f069ee4e11297d 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,
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.
+ const 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);
};
« no previous file with comments | « chrome/renderer/extensions/app_bindings.cc ('k') | chrome/renderer/extensions/chrome_v8_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698