Chromium Code Reviews| Index: chrome/renderer/extensions/dispatcher.cc |
| diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc |
| index eeed3250898818bbcea6f1e6e22804521e8909a0..0a2ea547278e8d8ee76a9ebd2abcdb978190cc97 100644 |
| --- a/chrome/renderer/extensions/dispatcher.cc |
| +++ b/chrome/renderer/extensions/dispatcher.cc |
| @@ -718,11 +718,12 @@ v8::Handle<v8::Object> Dispatcher::GetOrCreateObject( |
| void Dispatcher::RegisterSchemaGeneratedBindings( |
| ModuleSystem* module_system, |
| ChromeV8Context* context) { |
| - std::set<std::string> apis = |
| - ExtensionAPI::GetSharedInstance()->GetAllAPINames(); |
| - for (std::set<std::string>::iterator it = apis.begin(); |
| + std::vector<std::string> apis = |
| + BaseFeatureProvider::GetByName("api")->GetAllTopLevelFeatureNames(); |
| + for (std::vector<std::string>::iterator it = apis.begin(); |
| it != apis.end(); ++it) { |
| const std::string& api_name = *it; |
| + |
| if (!context->IsAnyFeatureAvailableToContext(api_name)) |
| continue; |
| @@ -751,7 +752,7 @@ void Dispatcher::RegisterSchemaGeneratedBindings( |
| bool only_ancestor_available = false; |
| for (size_t i = 0; i < split.size() - 1; ++i) { |
| ancestor_name += (i ? ".": "") + split[i]; |
| - if (!ancestor_name.empty() && |
| + if (ancestor_name == "app" && // !ancestor_name.empty() && |
|
not at google - send to devlin
2013/05/23 00:09:40
commented out?
not at google - send to devlin
2013/05/23 00:09:40
commented out?
cduvall
2013/05/24 03:13:49
I changed this to just checking when the ancestor
not at google - send to devlin
2013/05/24 19:09:18
what check? yeah it seems like if there's no featu
|
| context->GetAvailability(ancestor_name).is_available() && |
| !context->GetAvailability(api_name).is_available()) { |
| only_ancestor_available = true; |
| @@ -1434,8 +1435,9 @@ bool Dispatcher::CheckContextAccessToExtensionAPI( |
| return false; |
| } |
| - if (ExtensionAPI::GetSharedInstance()->IsPrivileged(function_name) && |
| - context->context_type() != Feature::BLESSED_EXTENSION_CONTEXT) { |
| + Feature* feature = |
| + BaseFeatureProvider::GetByName("api")->GetFeature(function_name); |
| + if (feature->GetContexts()->count(context->context_type()) == 0) { |
| static const char kMessage[] = |
| "%s can only be used in an extension process."; |
|
not at google - send to devlin
2013/05/23 00:09:40
this error message will need to change
cduvall
2013/05/24 03:13:49
Switched this to just using the features and getti
|
| std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); |