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

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

Issue 14494013: Allow API functions and events to have entries in _api_features.json (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: chrome/common/extensions/api/extension_api.cc
diff --git a/chrome/common/extensions/api/extension_api.cc b/chrome/common/extensions/api/extension_api.cc
index 9862c5fa11854e42fc96c1c3122aea3d3db4d060..63428d43e34ea8e79b6264e52dd795683442f28f 100644
--- a/chrome/common/extensions/api/extension_api.cc
+++ b/chrome/common/extensions/api/extension_api.cc
@@ -409,6 +409,29 @@ void ExtensionAPI::RegisterDependencyProvider(const std::string& name,
dependency_providers_[name] = provider;
}
+Feature::Availability ExtensionAPI::IsPartAvailableToContext(
not at google - send to devlin 2013/04/27 01:02:43 this method should probably return a bool, since i
cduvall 2013/05/01 02:51:47 Done.
+ const std::string& api_name,
+ Feature::Context context,
+ const GURL& url) {
+ FeatureProviderMap::iterator provider = dependency_providers_.find("api");
+ CHECK(provider != dependency_providers_.end());
+ std::set<std::string> features = provider->second->GetAllFeatureNames();
+
+ // Check to see if there are any parts of this API that are allowed in this
+ // context.
+ for (std::set<std::string>::iterator i = features.begin();
+ i != features.end(); ++i) {
+ std::string feature_name = *i;
not at google - send to devlin 2013/04/27 01:02:43 std::string&
cduvall 2013/05/01 02:51:47 Done.
+ if (feature_name != api_name && feature_name.find(api_name) == 0) {
not at google - send to devlin 2013/04/27 01:02:43 i'm worried that at some point we'll have API name
cduvall 2013/05/01 02:51:47 Done.
+ Feature::Availability availability =
+ IsAvailable(feature_name, NULL, context, url);
+ if (availability.is_available())
+ return availability;
+ }
+ }
+ return IsAvailable(api_name, NULL, context, url);
+}
+
Feature::Availability ExtensionAPI::IsAvailable(const std::string& full_name,
const Extension* extension,
Feature::Context context,

Powered by Google App Engine
This is Rietveld 408576698