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

Unified Diff: chrome/browser/extensions/extension_web_ui.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 years, 9 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/extension_web_ui.cc
diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc
index c1e2befb7a5a1e5e7bff4a70acf5a5e8455d14a9..e90ad7714ef0e590f2aba129e6c8941b9b5340d2 100644
--- a/chrome/browser/extensions/extension_web_ui.cc
+++ b/chrome/browser/extensions/extension_web_ui.cc
@@ -66,17 +66,17 @@ const char kActive[] = "active";
void InitializeOverridesList(base::ListValue* list) {
base::ListValue migrated;
std::set<std::string> seen_entries;
- for (const auto& val : *list) {
+ for (auto& val : *list) {
std::unique_ptr<base::DictionaryValue> new_dict(
new base::DictionaryValue());
std::string entry_name;
base::DictionaryValue* existing_dict = nullptr;
- if (val->GetAsDictionary(&existing_dict)) {
+ if (val.GetAsDictionary(&existing_dict)) {
bool success = existing_dict->GetString(kEntry, &entry_name);
if (!success) // See comment about CHECK(success) in ForEachOverrideList.
continue;
new_dict->Swap(existing_dict);
- } else if (val->GetAsString(&entry_name)) {
+ } else if (val.GetAsString(&entry_name)) {
new_dict->SetString(kEntry, entry_name);
new_dict->SetBoolean(kActive, true);
} else {
@@ -97,10 +97,10 @@ void InitializeOverridesList(base::ListValue* list) {
// marks it as active.
void AddOverridesToList(base::ListValue* list,
const std::string& override) {
- for (const auto& val : *list) {
+ for (auto& val : *list) {
base::DictionaryValue* dict = nullptr;
std::string entry;
- if (!val->GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) {
+ if (!val.GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) {
NOTREACHED();
continue;
}
@@ -122,10 +122,10 @@ void AddOverridesToList(base::ListValue* list,
void ValidateOverridesList(const extensions::ExtensionSet* all_extensions,
base::ListValue* list) {
base::ListValue migrated;
- for (const auto& val : *list) {
+ for (auto& val : *list) {
base::DictionaryValue* dict = nullptr;
std::string entry;
- if (!val->GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) {
+ if (!val.GetAsDictionary(&dict) || !dict->GetString(kEntry, &entry)) {
NOTREACHED();
continue;
}
@@ -175,20 +175,19 @@ enum UpdateBehavior {
bool UpdateOverridesList(base::ListValue* overrides_list,
const std::string& override_url,
UpdateBehavior behavior) {
- base::ListValue::iterator iter =
- std::find_if(overrides_list->begin(), overrides_list->end(),
- [&override_url](const std::unique_ptr<base::Value>& value) {
- std::string entry;
- const base::DictionaryValue* dict = nullptr;
- return value->GetAsDictionary(&dict) &&
- dict->GetString(kEntry, &entry) &&
- entry == override_url;
- });
+ base::ListValue::iterator iter = std::find_if(
+ overrides_list->begin(), overrides_list->end(),
+ [&override_url](const base::Value& value) {
+ std::string entry;
+ const base::DictionaryValue* dict = nullptr;
+ return value.GetAsDictionary(&dict) &&
+ dict->GetString(kEntry, &entry) && entry == override_url;
+ });
if (iter != overrides_list->end()) {
switch (behavior) {
case UPDATE_DEACTIVATE: {
base::DictionaryValue* dict = nullptr;
- bool success = (*iter)->GetAsDictionary(&dict);
+ bool success = iter->GetAsDictionary(&dict);
// See comment about CHECK(success) in ForEachOverrideList.
if (success) {
dict->SetBoolean(kActive, false);
@@ -426,7 +425,7 @@ bool ExtensionWebUI::HandleChromeURLOverrideReverse(
for (base::ListValue::const_iterator list_iter = url_list->begin();
list_iter != url_list->end(); ++list_iter) {
const base::DictionaryValue* dict = nullptr;
- if (!(*list_iter)->GetAsDictionary(&dict))
+ if (!list_iter->GetAsDictionary(&dict))
continue;
std::string override;
if (!dict->GetString(kEntry, &override))

Powered by Google App Engine
This is Rietveld 408576698