Chromium Code Reviews| Index: chrome/common/extensions/api/extension_api.h |
| diff --git a/chrome/common/extensions/api/extension_api.h b/chrome/common/extensions/api/extension_api.h |
| index 128129e98c1b3a2933203369adfacd722c14955b..4e80ffce2773090285dd094d621c145b88269d95 100644 |
| --- a/chrome/common/extensions/api/extension_api.h |
| +++ b/chrome/common/extensions/api/extension_api.h |
| @@ -71,9 +71,13 @@ class ExtensionAPI : public FeatureProvider { |
| // either a namespace name (like "bookmarks") or a member name (like |
| // "bookmarks.create"). Returns true if the feature and all of its |
| // dependencies are available to the specified context. |
| - bool IsAvailable(const std::string& api_full_name, |
| - const Extension* extension, |
| - Feature::Context context); |
| + Feature::Availability IsAvailable(const std::string& api_full_name, |
| + const Extension* extension, |
| + Feature::Context context, |
| + const GURL& url); |
| + |
| + // Returns true if the API uses the feature system. |
| + bool UsesFeatureSystem(const std::string& full_name); |
|
not at google - send to devlin
2013/03/14 19:16:46
looks like this can be moved back out of public:
cduvall
2013/03/21 22:27:55
Done.
|
| // Returns true if |name| is a privileged API path. Privileged paths can only |
| // be called from extension code which is running in its own designated |
| @@ -85,11 +89,13 @@ class ExtensionAPI : public FeatureProvider { |
| // Ownership remains with this object. |
| const base::DictionaryValue* GetSchema(const std::string& full_name); |
| - // Gets the APIs available to |context| given an |extension| and |url|. The |
| - // extension or URL may not be relevant to all contexts, and may be left |
| + // Check if an API is available to |context| given an |extension| and |url|. |
| + // The extension or URL may not be relevant to all contexts, and may be left |
| // NULL/empty. |
| - std::set<std::string> GetAPIsForContext( |
| - Feature::Context context, const Extension* extension, const GURL& url); |
| + bool IsNonFeatureAvailable(const std::string& name, |
|
not at google - send to devlin
2013/03/14 19:16:46
First file I'm reading: this name confuses me.
Al
cduvall
2013/03/21 22:27:55
renamed to IsNonFeatureAPIAvailable()
|
| + Feature::Context context, |
| + const Extension* extension, |
| + const GURL& url); |
| std::set<std::string> GetAllAPINames(); |
| @@ -112,9 +118,6 @@ class ExtensionAPI : public FeatureProvider { |
| void InitDefaultConfiguration(); |
| - // Loads the schemas registered with RegisterSchema(). |
| - void LoadAllSchemas(); |
| - |
| private: |
| friend struct DefaultSingletonTraits<ExtensionAPI>; |
| @@ -127,11 +130,10 @@ class ExtensionAPI : public FeatureProvider { |
| bool IsChildNamePrivileged(const base::DictionaryValue* namespace_node, |
| const std::string& child_name); |
| - // Adds all APIs to |out| that |extension| has any permission (required or |
| - // optional) to use. |
| + // Checks if API |name| is allowed. |
| // NOTE: This only works for non-feature-controlled APIs. |
| // TODO(aa): Remove this when all APIs are converted to the feature system. |
| - void GetAllowedAPIs(const Extension* extension, std::set<std::string>* out); |
| + bool IsAPIAllowed(const std::string& name, const Extension* extension); |
| // Gets a feature from any dependency provider. |
| Feature* GetFeatureDependency(const std::string& dependency_name); |
| @@ -148,15 +150,10 @@ class ExtensionAPI : public FeatureProvider { |
| const std::set<std::string>& excluding, |
| std::set<std::string>* out); |
| - // Removes all APIs from |apis| which are *entirely* privileged. This won't |
| - // include APIs such as "storage" which is entirely unprivileged, nor |
| - // "extension" which has unprivileged components. |
| - void RemovePrivilegedAPIs(std::set<std::string>* apis); |
| - |
| - // Adds an APIs that match |url| to |out|. |
| - // NOTE: This only works for non-feature-controlled APIs. |
| - // TODO(aa): Remove this when all APIs are converted to the feature system. |
| - void GetAPIsMatchingURL(const GURL& url, std::set<std::string>* out); |
| + // Checks if an API is *entirely* privileged. This won't include APIs such as |
| + // "storage" which is entirely unprivileged, nor "extension" which has |
| + // unprivileged components. |
| + bool IsPrivilegedAPI(const std::string& name); |
| // Map from each API that hasn't been loaded yet to the schema which defines |
| // it. Note that there may be multiple APIs per schema. |