summaryrefslogtreecommitdiffstats
path: root/extensions/common/features
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-02-24 12:21:10 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-24 20:21:38 +0000
commit69bf75316e7ae533c0a0dccc1a56ca019aa95a1e (patch)
tree19c73070991a2965d12a784760136c3247be45b6 /extensions/common/features
parent1d7ceee2bfb36e0a21e2d224a3bd13c447d293d7 (diff)
downloadchromium_src-69bf75316e7ae533c0a0dccc1a56ca019aa95a1e.zip
chromium_src-69bf75316e7ae533c0a0dccc1a56ca019aa95a1e.tar.gz
chromium_src-69bf75316e7ae533c0a0dccc1a56ca019aa95a1e.tar.bz2
[Extensions] Start making chrome://extensions use extensions APIs
Allow chrome://extensions to use the developerPrivate and management apis, and make it do so for enabling/disabling extensions. Also, shave yaks: - Make management api check requirements for extensions. - Make feature provider aware of complex parents. And bonus: - Remove WeakPtr interface from RequirementsChecker BUG=461039 Review URL: https://codereview.chromium.org/951633002 Cr-Commit-Position: refs/heads/master@{#317871}
Diffstat (limited to 'extensions/common/features')
-rw-r--r--extensions/common/features/base_feature_provider.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/extensions/common/features/base_feature_provider.cc b/extensions/common/features/base_feature_provider.cc
index 9b927cc..40807f41 100644
--- a/extensions/common/features/base_feature_provider.cc
+++ b/extensions/common/features/base_feature_provider.cc
@@ -66,7 +66,20 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root,
split.pop_back();
if (root.HasKey(parent_name)) {
const base::DictionaryValue* parent = nullptr;
- CHECK(root.GetDictionaryWithoutPathExpansion(parent_name, &parent));
+ if (!root.GetDictionaryWithoutPathExpansion(parent_name, &parent)) {
+ // If the parent is a complex feature, find the parent with the
+ // 'default_parent' flag.
+ const base::ListValue* parent_list = nullptr;
+ CHECK(root.GetListWithoutPathExpansion(parent_name, &parent_list));
+ for (size_t i = 0; i < parent_list->GetSize(); ++i) {
+ CHECK(parent_list->GetDictionary(i, &parent));
+ if (parent->HasKey("default_parent"))
+ break;
+ parent = nullptr;
+ }
+ CHECK(parent) << parent_name << " must declare one of its features"
+ << " the default parent, with {\"default_parent\": true}.";
+ }
parse_stack.push(std::make_pair(parent_name, parent));
bool no_parent = false;
parent->GetBoolean("noparent", &no_parent);