summaryrefslogtreecommitdiffstats
path: root/extensions/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/renderer')
-rw-r--r--extensions/renderer/api_definitions_natives.cc12
-rw-r--r--extensions/renderer/dispatcher.cc17
2 files changed, 10 insertions, 19 deletions
diff --git a/extensions/renderer/api_definitions_natives.cc b/extensions/renderer/api_definitions_natives.cc
index 61ea710..96f1f2c 100644
--- a/extensions/renderer/api_definitions_natives.cc
+++ b/extensions/renderer/api_definitions_natives.cc
@@ -24,14 +24,10 @@ void ApiDefinitionsNatives::GetExtensionAPIDefinitionsForTest(
const v8::FunctionCallbackInfo<v8::Value>& args) {
std::vector<std::string> apis;
const FeatureProvider* feature_provider = FeatureProvider::GetAPIFeatures();
- const std::vector<std::string>& feature_names =
- feature_provider->GetAllFeatureNames();
- for (std::vector<std::string>::const_iterator i = feature_names.begin();
- i != feature_names.end();
- ++i) {
- if (!feature_provider->GetParent(feature_provider->GetFeature(*i)) &&
- context()->GetAvailability(*i).is_available()) {
- apis.push_back(*i);
+ for (const auto& map_entry : feature_provider->GetAllFeatures()) {
+ if (!feature_provider->GetParent(map_entry.second.get()) &&
+ context()->GetAvailability(map_entry.first).is_available()) {
+ apis.push_back(map_entry.first);
}
}
args.GetReturnValue().Set(
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index c3718d9..5ff2616e 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;
}