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

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.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
« no previous file with comments | « chrome/browser/ui/webui/nacl_ui.cc ('k') | chrome/browser/ui/webui/options/certificate_manager_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/options/browser_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index 0de0316a7c25f2ff52fe88636069e68900b8b305..034a4adf02a470e7a812d66c5218e03d020be656 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -7,6 +7,7 @@
#include <stddef.h>
#include <set>
+#include <utility>
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -1232,10 +1233,10 @@ void BrowserOptionsHandler::OnTemplateURLServiceChanged() {
template_url_service_->search_terms_data()))
continue;
- base::DictionaryValue* entry = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue());
entry->SetString("name", model_urls[i]->short_name());
entry->SetInteger("index", i);
- search_engines.Append(entry);
+ search_engines.Append(std::move(entry));
if (model_urls[i] == default_url)
default_index = i;
}
@@ -1355,7 +1356,8 @@ std::unique_ptr<base::ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
// The items in |profile_value| are also described in
// chrome/browser/resources/options/browser_options.js in a @typedef for
// Profile. Please update it whenever you add or remove any keys here.
- base::DictionaryValue* profile_value = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> profile_value(
+ new base::DictionaryValue());
profile_value->SetString("name", entry->GetName());
base::FilePath profile_path = entry->GetPath();
profile_value->Set("filePath", base::CreateFilePathValue(profile_path));
@@ -1375,7 +1377,7 @@ std::unique_ptr<base::ListValue> BrowserOptionsHandler::GetProfilesInfoList() {
profiles::GetDefaultAvatarIconUrl(icon_index));
}
- profile_info_list->Append(profile_value);
+ profile_info_list->Append(std::move(profile_value));
}
return profile_info_list;
@@ -2004,14 +2006,14 @@ void BrowserOptionsHandler::SetupPageZoomSelector() {
base::ListValue zoom_factors_value;
for (std::vector<double>::const_iterator i = zoom_factors.begin();
i != zoom_factors.end(); ++i) {
- base::ListValue* option = new base::ListValue();
+ std::unique_ptr<base::ListValue> option(new base::ListValue());
double factor = *i;
int percent = static_cast<int>(factor * 100 + 0.5);
option->AppendString(base::FormatPercent(percent));
option->AppendDouble(factor);
bool selected = content::ZoomValuesEqual(factor, default_zoom_factor);
option->AppendBoolean(selected);
- zoom_factors_value.Append(option);
+ zoom_factors_value.Append(std::move(option));
}
web_ui()->CallJavascriptFunctionUnsafe("BrowserOptions.setupPageZoomSelector",
« no previous file with comments | « chrome/browser/ui/webui/nacl_ui.cc ('k') | chrome/browser/ui/webui/options/certificate_manager_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698