Chromium Code Reviews| 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, |