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

Side by Side Diff: chrome/browser/ui/webui/nacl_ui.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/nacl_ui.h" 5 #include "chrome/browser/ui/webui/nacl_ui.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
9 #include <string> 10 #include <string>
11 #include <utility>
10 #include <vector> 12 #include <vector>
11 13
12 #include "base/bind.h" 14 #include "base/bind.h"
13 #include "base/bind_helpers.h" 15 #include "base/bind_helpers.h"
14 #include "base/command_line.h" 16 #include "base/command_line.h"
15 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
16 #include "base/json/json_file_value_serializer.h" 18 #include "base/json/json_file_value_serializer.h"
17 #include "base/macros.h" 19 #include "base/macros.h"
18 #include "base/memory/weak_ptr.h" 20 #include "base/memory/weak_ptr.h"
19 #include "base/path_service.h" 21 #include "base/path_service.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 "requestNaClInfo", 154 "requestNaClInfo",
153 base::Bind(&NaClDomHandler::HandleRequestNaClInfo, 155 base::Bind(&NaClDomHandler::HandleRequestNaClInfo,
154 base::Unretained(this))); 156 base::Unretained(this)));
155 } 157 }
156 158
157 // Helper functions for collecting a list of key-value pairs that will 159 // Helper functions for collecting a list of key-value pairs that will
158 // be displayed. 160 // be displayed.
159 void AddPair(base::ListValue* list, 161 void AddPair(base::ListValue* list,
160 const base::string16& key, 162 const base::string16& key,
161 const base::string16& value) { 163 const base::string16& value) {
162 base::DictionaryValue* results = new base::DictionaryValue(); 164 std::unique_ptr<base::DictionaryValue> results(new base::DictionaryValue());
163 results->SetString("key", key); 165 results->SetString("key", key);
164 results->SetString("value", value); 166 results->SetString("value", value);
165 list->Append(results); 167 list->Append(std::move(results));
166 } 168 }
167 169
168 // Generate an empty data-pair which acts as a line break. 170 // Generate an empty data-pair which acts as a line break.
169 void AddLineBreak(base::ListValue* list) { 171 void AddLineBreak(base::ListValue* list) {
170 AddPair(list, ASCIIToUTF16(""), ASCIIToUTF16("")); 172 AddPair(list, ASCIIToUTF16(""), ASCIIToUTF16(""));
171 } 173 }
172 174
173 bool NaClDomHandler::isPluginEnabled(size_t plugin_index) { 175 bool NaClDomHandler::isPluginEnabled(size_t plugin_index) {
174 std::vector<content::WebPluginInfo> info_array; 176 std::vector<content::WebPluginInfo> info_array;
175 PluginService::GetInstance()->GetPluginInfoArray( 177 PluginService::GetInstance()->GetPluginInfoArray(
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 387
386 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) { 388 NaClUI::NaClUI(content::WebUI* web_ui) : WebUIController(web_ui) {
387 content::RecordAction(UserMetricsAction("ViewAboutNaCl")); 389 content::RecordAction(UserMetricsAction("ViewAboutNaCl"));
388 390
389 web_ui->AddMessageHandler(new NaClDomHandler()); 391 web_ui->AddMessageHandler(new NaClDomHandler());
390 392
391 // Set up the about:nacl source. 393 // Set up the about:nacl source.
392 Profile* profile = Profile::FromWebUI(web_ui); 394 Profile* profile = Profile::FromWebUI(web_ui);
393 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource()); 395 content::WebUIDataSource::Add(profile, CreateNaClUIHTMLSource());
394 } 396 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/instant_ui.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698