OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_store.
h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 settings->Append(setting_dict); | 281 settings->Append(setting_dict); |
282 } | 282 } |
283 } | 283 } |
284 return settings; | 284 return settings; |
285 } | 285 } |
286 | 286 |
287 void ContentSettingsStore::SetExtensionContentSettingFromList( | 287 void ContentSettingsStore::SetExtensionContentSettingFromList( |
288 const std::string& extension_id, | 288 const std::string& extension_id, |
289 const base::ListValue* list, | 289 const base::ListValue* list, |
290 ExtensionPrefsScope scope) { | 290 ExtensionPrefsScope scope) { |
291 for (base::ListValue::const_iterator it = list->begin(); | 291 for (const auto& value : *list) { |
292 it != list->end(); ++it) { | 292 base::DictionaryValue* dict; |
293 if ((*it)->GetType() != base::Value::TYPE_DICTIONARY) { | 293 if (!value->GetAsDictionary(&dict)) { |
294 NOTREACHED(); | 294 NOTREACHED(); |
295 continue; | 295 continue; |
296 } | 296 } |
297 base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(*it); | |
298 std::string primary_pattern_str; | 297 std::string primary_pattern_str; |
299 dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str); | 298 dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str); |
300 ContentSettingsPattern primary_pattern = | 299 ContentSettingsPattern primary_pattern = |
301 ContentSettingsPattern::FromString(primary_pattern_str); | 300 ContentSettingsPattern::FromString(primary_pattern_str); |
302 DCHECK(primary_pattern.IsValid()); | 301 DCHECK(primary_pattern.IsValid()); |
303 | 302 |
304 std::string secondary_pattern_str; | 303 std::string secondary_pattern_str; |
305 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str); | 304 dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str); |
306 ContentSettingsPattern secondary_pattern = | 305 ContentSettingsPattern secondary_pattern = |
307 ContentSettingsPattern::FromString(secondary_pattern_str); | 306 ContentSettingsPattern::FromString(secondary_pattern_str); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ContentSettingsStore::FindEntry(const std::string& ext_id) const { | 371 ContentSettingsStore::FindEntry(const std::string& ext_id) const { |
373 ExtensionEntryMap::const_iterator i; | 372 ExtensionEntryMap::const_iterator i; |
374 for (i = entries_.begin(); i != entries_.end(); ++i) { | 373 for (i = entries_.begin(); i != entries_.end(); ++i) { |
375 if (i->second->id == ext_id) | 374 if (i->second->id == ext_id) |
376 return i; | 375 return i; |
377 } | 376 } |
378 return entries_.end(); | 377 return entries_.end(); |
379 } | 378 } |
380 | 379 |
381 } // namespace extensions | 380 } // namespace extensions |
OLD | NEW |