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

Unified Diff: chrome/browser/supervised_user/supervised_user_site_list.cc

Issue 615493005: c/b/supervised_user: Use range-based for where appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/supervised_user/supervised_user_site_list.cc
diff --git a/chrome/browser/supervised_user/supervised_user_site_list.cc b/chrome/browser/supervised_user/supervised_user_site_list.cc
index b71e6a9bb9908c75226847a82030562cafbea91d..14456e22ea4d2b1210e10a527370d76ffaaa6bd6 100644
--- a/chrome/browser/supervised_user/supervised_user_site_list.cc
+++ b/chrome/browser/supervised_user/supervised_user_site_list.cc
@@ -76,10 +76,9 @@ void AddWhitelistEntries(const base::DictionaryValue* site_dict,
const base::ListValue* whitelist = NULL;
if (site_dict->GetList(kWhitelistKey, &whitelist)) {
found = true;
- for (base::ListValue::const_iterator whitelist_it = whitelist->begin();
- whitelist_it != whitelist->end(); ++whitelist_it) {
+ for (const auto* entry : *whitelist) {
std::string pattern;
- if (!(*whitelist_it)->GetAsString(&pattern)) {
+ if (!entry->GetAsString(&pattern)) {
LOG(ERROR) << "Invalid whitelist entry";
continue;
}
@@ -92,10 +91,9 @@ void AddWhitelistEntries(const base::DictionaryValue* site_dict,
const base::ListValue* hash_list = NULL;
if (site_dict->GetList(kHostnameHashesKey, &hash_list)) {
found = true;
- for (base::ListValue::const_iterator hash_list_it = hash_list->begin();
- hash_list_it != hash_list->end(); ++hash_list_it) {
+ for (const auto* entry : *hash_list) {
std::string hash;
- if (!(*hash_list_it)->GetAsString(&hash)) {
+ if (!entry->GetAsString(&hash)) {
LOG(ERROR) << "Invalid whitelist entry";
continue;
}
@@ -159,10 +157,9 @@ void SupervisedUserSiteList::GetSites(std::vector<Site>* sites) {
if (!LazyLoad())
return;
- for (base::ListValue::iterator entry_it = sites_->begin();
- entry_it != sites_->end(); ++entry_it) {
- base::DictionaryValue* entry = NULL;
- if (!(*entry_it)->GetAsDictionary(&entry)) {
+ for (const auto* site : *sites_) {
+ const base::DictionaryValue* entry = NULL;
+ if (!site->GetAsDictionary(&entry)) {
LOG(ERROR) << "Entry is invalid";
continue;
}
@@ -175,10 +172,9 @@ void SupervisedUserSiteList::GetSites(std::vector<Site>* sites) {
int category_id = 0;
const base::ListValue* categories = NULL;
if (entry->GetList(kCategoriesKey, &categories)) {
- for (base::ListValue::const_iterator it = categories->begin();
- it != categories->end(); ++it) {
+ for (const auto* category_entry : *categories) {
std::string category;
- if (!(*it)->GetAsString(&category)) {
+ if (!category_entry->GetAsString(&category)) {
LOG(ERROR) << "Invalid category";
continue;
}
@@ -192,7 +188,7 @@ void SupervisedUserSiteList::GetSites(std::vector<Site>* sites) {
}
bool SupervisedUserSiteList::LazyLoad() {
- if (sites_.get())
+ if (sites_)
return true;
JSONFileValueSerializer serializer(path_);

Powered by Google App Engine
This is Rietveld 408576698