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

Unified Diff: extensions/renderer/dispatcher.cc

Issue 1772683002: FeatureProvider returns std::map instead of vector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 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 | « extensions/renderer/api_definitions_natives.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/dispatcher.cc
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index c3718d978b8fade24e5c1b55bfff4a38bc05dc1b..5ff2616e7e736ad0a90069a7d4132703329694ad 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -1345,31 +1345,26 @@ void Dispatcher::UpdateBindingsForContext(ScriptContext* context) {
// ones.
const FeatureProvider* api_feature_provider =
FeatureProvider::GetAPIFeatures();
- const std::vector<std::string>& apis =
- api_feature_provider->GetAllFeatureNames();
- for (const std::string& api_name : apis) {
- Feature* feature = api_feature_provider->GetFeature(api_name);
- DCHECK(feature);
-
+ for (const auto& map_entry : api_feature_provider->GetAllFeatures()) {
// Internal APIs are included via require(api_name) from internal code
// rather than chrome[api_name].
- if (feature->IsInternal())
+ if (map_entry.second->IsInternal())
continue;
// If this API has a parent feature (and isn't marked 'noparent'),
// then this must be a function or event, so we should not register.
- if (api_feature_provider->GetParent(feature) != NULL)
+ if (api_feature_provider->GetParent(map_entry.second.get()) != nullptr)
continue;
// Skip chrome.test if this isn't a test.
- if (api_name == "test" &&
+ if (map_entry.first == "test" &&
!base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kTestType)) {
continue;
}
- if (context->IsAnyFeatureAvailableToContext(*feature))
- RegisterBinding(api_name, context);
+ if (context->IsAnyFeatureAvailableToContext(*map_entry.second.get()))
+ RegisterBinding(map_entry.first, context);
}
break;
}
« no previous file with comments | « extensions/renderer/api_definitions_natives.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698