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

Unified Diff: chrome/common/extensions/api/extension_api.h

Issue 12522004: Lazily load extension API schemas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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/common/extensions/api/extension.json ('k') | chrome/common/extensions/api/extension_api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..924ee8cb52abd76914f8ef9d7fccbeb4463f0b3c 100644
--- a/chrome/common/extensions/api/extension_api.h
+++ b/chrome/common/extensions/api/extension_api.h
@@ -71,9 +71,10 @@ 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 |name| is a privileged API path. Privileged paths can only
// be called from extension code which is running in its own designated
@@ -85,12 +86,6 @@ 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
- // NULL/empty.
- std::set<std::string> GetAPIsForContext(
- Feature::Context context, const Extension* extension, const GURL& url);
-
std::set<std::string> GetAllAPINames();
// Gets a Feature object describing the API with the specified |full_name|.
@@ -112,9 +107,6 @@ class ExtensionAPI : public FeatureProvider {
void InitDefaultConfiguration();
- // Loads the schemas registered with RegisterSchema().
- void LoadAllSchemas();
-
private:
friend struct DefaultSingletonTraits<ExtensionAPI>;
@@ -127,11 +119,23 @@ 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.
- // 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);
+ // NOTE: This IsAPIAllowed() and IsNonFeatureAPIAvailable only work for
+ // non-feature-controlled APIs.
+ // TODO(aa): Remove these when all APIs are converted to the feature system.
+
+ // Checks if API |name| is allowed.
+ bool IsAPIAllowed(const std::string& name, const Extension* extension);
+
+ // 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.
+ bool IsNonFeatureAPIAvailable(const std::string& name,
+ Feature::Context context,
+ const Extension* extension,
+ const GURL& url);
+
+ // Returns true if the API uses the feature system.
+ bool UsesFeatureSystem(const std::string& full_name);
// Gets a feature from any dependency provider.
Feature* GetFeatureDependency(const std::string& dependency_name);
@@ -148,15 +152,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.
« no previous file with comments | « chrome/common/extensions/api/extension.json ('k') | chrome/common/extensions/api/extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698