| Index: extensions/common/features/feature_provider.cc
|
| diff --git a/extensions/common/features/feature_provider.cc b/extensions/common/features/feature_provider.cc
|
| index 5e5b14519e50e55c49f0ed5c6fbbaf2da213a24b..0d2f792a65dfb56a617e18dc90d4a500bd2304d0 100644
|
| --- a/extensions/common/features/feature_provider.cc
|
| +++ b/extensions/common/features/feature_provider.cc
|
| @@ -140,12 +140,17 @@ Feature* FeatureProvider::GetParent(Feature* feature) const {
|
| if (feature->no_parent())
|
| return nullptr;
|
|
|
| - std::vector<base::StringPiece> split = base::SplitStringPiece(
|
| - feature->name(), ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
| - if (split.size() < 2)
|
| - return nullptr;
|
| - split.pop_back();
|
| - return GetFeature(base::JoinString(split, "."));
|
| + base::StringPiece name = feature->name();
|
| + base::StringPiece::size_type pos = base::StringPiece::npos;
|
| + // Continue searching up the chain, so that foo.child.grandchild has a parent
|
| + // of foo (even if foo.child isn't explicitly defined).
|
| + while ((pos = name.rfind('.')) != base::StringPiece::npos) {
|
| + name = name.substr(0, pos);
|
| + Feature* feature = GetFeature(name.as_string());
|
| + if (feature)
|
| + return feature;
|
| + }
|
| + return nullptr;
|
| }
|
|
|
| // Children of a given API are named starting with parent.name()+".", which
|
|
|