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

Unified Diff: components/error_page/common/localized_error.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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: components/error_page/common/localized_error.cc
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc
index 4b807d8218159fee771dffa24085f047a3701d9f..59a0f1e40b8dcb6aaac46887bd04feadd3fb0218 100644
--- a/components/error_page/common/localized_error.cc
+++ b/components/error_page/common/localized_error.cc
@@ -6,6 +6,8 @@
#include <stddef.h>
+#include <utility>
+
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
@@ -648,11 +650,12 @@ void AddLinkedSuggestionToList(const int error_code,
repl.SetQueryStr(query);
GURL learn_more_url_with_locale = learn_more_url.ReplaceComponents(repl);
- base::DictionaryValue* suggestion_list_item = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> suggestion_list_item(
+ new base::DictionaryValue);
suggestion_list_item->SetString("summary", suggestion_string);
suggestion_list_item->SetString("learnMoreUrl",
learn_more_url_with_locale.spec());
- suggestions_summary_list->Append(suggestion_list_item);
+ suggestions_summary_list->Append(std::move(suggestion_list_item));
}
// Check if a suggestion is in the bitmap of suggestions.
@@ -1047,7 +1050,8 @@ void LocalizedError::GetStrings(
error_strings->Set("suggestionsSummaryList", suggestions_summary_list);
if (params->search_url.is_valid()) {
- base::DictionaryValue* search_suggestion = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> search_suggestion(
+ new base::DictionaryValue);
search_suggestion->SetString("summary",l10n_util::GetStringUTF16(
IDS_ERRORPAGES_SUGGESTION_GOOGLE_SEARCH_SUMMARY));
search_suggestion->SetString("searchUrl", params->search_url.spec() +
@@ -1055,7 +1059,7 @@ void LocalizedError::GetStrings(
search_suggestion->SetString("searchTerms", params->search_terms);
search_suggestion->SetInteger("trackingId",
params->search_tracking_id);
- suggestions_summary_list->Append(search_suggestion);
+ suggestions_summary_list->Append(std::move(search_suggestion));
}
// Add the reload suggestion, if needed for pages that didn't come
« no previous file with comments | « components/crash/core/browser/crashes_ui_util.cc ('k') | components/error_page/renderer/net_error_helper_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698