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

Unified Diff: chrome/browser/ui/webui/components_ui.cc

Issue 2814363006: Reland of Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: std::move Created 3 years, 8 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/components_ui.h ('k') | chrome/browser/ui/webui/cookies_tree_model_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/components_ui.cc
diff --git a/chrome/browser/ui/webui/components_ui.cc b/chrome/browser/ui/webui/components_ui.cc
index 2b716f5d6953be2e09b6e36f308d77358615a2a7..d815653ffc42925125f9655647d4e06bad03325a 100644
--- a/chrome/browser/ui/webui/components_ui.cc
+++ b/chrome/browser/ui/webui/components_ui.cc
@@ -104,9 +104,8 @@ void ComponentsDOMHandler::RegisterMessages() {
void ComponentsDOMHandler::HandleRequestComponentsData(
const base::ListValue* args) {
- base::ListValue* list = ComponentsUI::LoadComponents();
base::DictionaryValue result;
- result.Set("components", list);
+ result.Set("components", ComponentsUI::LoadComponents());
web_ui()->CallJavascriptFunctionUnsafe("returnComponentsData", result);
}
@@ -164,14 +163,14 @@ void ComponentsUI::OnDemandUpdate(const std::string& component_id) {
}
// static
-base::ListValue* ComponentsUI::LoadComponents() {
+std::unique_ptr<base::ListValue> ComponentsUI::LoadComponents() {
component_updater::ComponentUpdateService* cus =
g_browser_process->component_updater();
std::vector<std::string> component_ids;
component_ids = cus->GetComponentIDs();
// Construct DictionaryValues to return to UI.
- base::ListValue* component_list = new base::ListValue();
+ auto component_list = base::MakeUnique<base::ListValue>();
for (size_t j = 0; j < component_ids.size(); ++j) {
update_client::CrxUpdateItem item;
if (cus->GetComponentDetails(component_ids[j], &item)) {
« no previous file with comments | « chrome/browser/ui/webui/components_ui.h ('k') | chrome/browser/ui/webui/cookies_tree_model_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698