Index: extensions/common/features/base_feature_provider.cc |
diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc |
index 8bcec82ce3d0071880feedbc580b7da2bb8984c5..069de389158c2882040eb2224425f3ad3854fcf9 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; |