Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: extensions/common/features/base_feature_provider.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/common/extension_api.cc ('k') | extensions/common/manifest_handlers/kiosk_mode_info.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4810e9e42b060be7669072d7351a2d643b5da22c..710a82749fa1f46a1abe601bfd150fdf0f1f9f9b 100644
--- a/extensions/common/features/base_feature_provider.cc
+++ b/extensions/common/features/base_feature_provider.cc
@@ -118,17 +118,15 @@ BaseFeatureProvider::BaseFeatureProvider(const base::DictionaryValue& root,
new ComplexFeature::FeatureList());
// Parse and add all SimpleFeatures from the list.
- for (base::ListValue::const_iterator list_iter = list->begin();
- list_iter != list->end(); ++list_iter) {
- if ((*list_iter)->GetType() != base::Value::TYPE_DICTIONARY) {
+ for (const auto& entry : *list) {
+ base::DictionaryValue* dict;
+ if (!entry->GetAsDictionary(&dict)) {
LOG(ERROR) << iter.key() << ": Feature rules must be dictionaries.";
continue;
}
std::unique_ptr<SimpleFeature> feature((*factory_)());
- if (!ParseFeature(static_cast<const base::DictionaryValue*>(*list_iter),
- iter.key(),
- feature.get()))
+ if (!ParseFeature(dict, iter.key(), feature.get()))
continue;
features->push_back(std::move(feature));
« no previous file with comments | « extensions/common/extension_api.cc ('k') | extensions/common/manifest_handlers/kiosk_mode_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698