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

Unified Diff: chrome/browser/extensions/api/content_settings/content_settings_store.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: Fix various builds. 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
Index: chrome/browser/extensions/api/content_settings/content_settings_store.cc
diff --git a/chrome/browser/extensions/api/content_settings/content_settings_store.cc b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
index 765636dbf9ec3793ae39732d508de8bc37c38e5a..bf120bc5b08a0d9a72f8da0e5119dc42a6e045bf 100644
--- a/chrome/browser/extensions/api/content_settings/content_settings_store.cc
+++ b/chrome/browser/extensions/api/content_settings/content_settings_store.cc
@@ -288,13 +288,12 @@ void ContentSettingsStore::SetExtensionContentSettingFromList(
const std::string& extension_id,
const base::ListValue* list,
ExtensionPrefsScope scope) {
- for (base::ListValue::const_iterator it = list->begin();
- it != list->end(); ++it) {
- if ((*it)->GetType() != base::Value::TYPE_DICTIONARY) {
+ for (const auto& value : *list) {
+ base::DictionaryValue* dict;
+ if (value->GetAsDictionary(&dict)) {
danakj 2016/05/24 20:08:34 do you mean if (!GetAsDictionary) ?
dcheng 2016/05/24 20:39:02 Yes. =X
NOTREACHED();
continue;
danakj 2016/05/24 20:08:34 ಠ_ಠ Should either DCHECK or continue not both. I s
dcheng 2016/05/24 20:39:02 Yeah, I think I'd rather not change the semantics
}
- base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(*it);
std::string primary_pattern_str;
dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str);
ContentSettingsPattern primary_pattern =

Powered by Google App Engine
This is Rietveld 408576698