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

Unified Diff: extensions/common/extension_api.h

Issue 2494653005: Support API aliases (Closed)
Patch Set: rebase Created 4 years, 1 month 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
Index: extensions/common/extension_api.h
diff --git a/extensions/common/extension_api.h b/extensions/common/extension_api.h
index 1453340a50e57fce64ba9fd3f5687a500f29feaa..e97813d2b39cdcaf4a53fda205f408c6df745635 100644
--- a/extensions/common/extension_api.h
+++ b/extensions/common/extension_api.h
@@ -86,20 +86,29 @@ class ExtensionAPI {
// |extension| or |url| (or both) may determine its availability, but this is
// up to the configuration of the individual feature.
//
+ // |allow_alias| determines whether it should be tested whether the API
+ // is available through an alias.
+ //
// TODO(kalman): This is just an unnecessary combination of finding a Feature
// then calling Feature::IsAvailableToContext(..) on it. Just provide that
// FindFeature function and let callers compose if they want.
Feature::Availability IsAvailable(const std::string& api_full_name,
const Extension* extension,
Feature::Context context,
- const GURL& url);
+ const GURL& url,
+ bool allow_alias);
Devlin 2016/11/14 18:03:56 I think this would be more clear with an enum, ALL
tbarzic 2016/11/15 04:45:07 Done.
- // Determines whether an API, or any parts of that API, are available in
+ // Determines whether an API, or any parts of that API, can be exposed to
// |context|.
+ //
+ // |allow_alias| determines whether it should be tested whether the API
+ // is available through an alias.
+ //
bool IsAnyFeatureAvailableToContext(const Feature& api,
const Extension* extension,
Feature::Context context,
- const GURL& url);
+ const GURL& url,
+ bool allow_alias);
Devlin 2016/11/14 18:03:56 ditto
tbarzic 2016/11/15 04:45:07 Done.
// Gets the StringPiece for the schema specified by |api_name|.
base::StringPiece GetSchemaStringPiece(const std::string& api_name);
@@ -136,6 +145,14 @@ class ExtensionAPI {
// testing purposes.
virtual bool IsKnownAPI(const std::string& name, ExtensionsClient* client);
+ // Checks if |full_name| is available to provided context and extension under
+ // associated API's alias name.
+ Feature::Availability IsAliasAvailable(const std::string& full_name,
+ Feature* api,
+ const Extension* extension,
+ Feature::Context context,
+ const GURL& url);
+
bool default_configuration_initialized_;
// Loads a schema.

Powered by Google App Engine
This is Rietveld 408576698