summaryrefslogtreecommitdiffstats
path: root/extensions/common/features/base_feature_provider.cc
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/common/features/base_feature_provider.cc')
-rw-r--r--extensions/common/features/base_feature_provider.cc21
1 files changed, 8 insertions, 13 deletions
diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc
index 8bcec82..069de38 100644
--- a/extensions/common/features/base_feature_provider.cc
+++ b/extensions/common/features/base_feature_provider.cc
@@ -149,19 +149,12 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root,
BaseFeatureProvider::~BaseFeatureProvider() {
}
-const std::vector<std::string>& BaseFeatureProvider::GetAllFeatureNames()
- const {
- if (feature_names_.empty()) {
- for (const auto& feature : features_)
- feature_names_.push_back(feature.first);
- // A std::map is sorted by its keys, so we don't need to sort feature_names_
- // now.
- }
- return feature_names_;
+const FeatureMap& BaseFeatureProvider::GetAllFeatures() const {
+ return features_;
}
Feature* BaseFeatureProvider::GetFeature(const std::string& name) const {
- const auto iter = features_.find(name);
+ FeatureMap::const_iterator iter = features_.find(name);
if (iter != features_.end())
return iter->second.get();
else
@@ -186,15 +179,17 @@ Feature* BaseFeatureProvider::GetParent(Feature* feature) const {
std::vector<Feature*> BaseFeatureProvider::GetChildren(const Feature& parent)
const {
std::string prefix = parent.name() + ".";
- const auto first_child = features_.lower_bound(prefix);
+ const FeatureMap::const_iterator first_child = features_.lower_bound(prefix);
// All children have names before (parent.name() + ('.'+1)).
++prefix[prefix.size() - 1];
- const auto after_children = features_.lower_bound(prefix);
+ const FeatureMap::const_iterator after_children =
+ features_.lower_bound(prefix);
std::vector<Feature*> result;
result.reserve(std::distance(first_child, after_children));
- for (auto it = first_child; it != after_children; ++it) {
+ for (FeatureMap::const_iterator it = first_child; it != after_children;
+ ++it) {
result.push_back(it->second.get());
}
return result;