OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/system_info_ui.h" | 5 #include "chrome/browser/ui/webui/system_info_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 154 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
155 webui::SetLoadTimeDataDefaults(app_locale, &strings); | 155 webui::SetLoadTimeDataDefaults(app_locale, &strings); |
156 | 156 |
157 if (response_.get()) { | 157 if (response_.get()) { |
158 base::ListValue* details = new base::ListValue(); | 158 base::ListValue* details = new base::ListValue(); |
159 strings.Set("details", details); | 159 strings.Set("details", details); |
160 for (SystemLogsResponse::const_iterator it = response_->begin(); | 160 for (SystemLogsResponse::const_iterator it = response_->begin(); |
161 it != response_->end(); | 161 it != response_->end(); |
162 ++it) { | 162 ++it) { |
163 base::DictionaryValue* val = new base::DictionaryValue; | 163 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue); |
164 val->SetString("statName", it->first); | 164 val->SetString("statName", it->first); |
165 val->SetString("statValue", it->second); | 165 val->SetString("statValue", it->second); |
166 details->Append(val); | 166 details->Append(std::move(val)); |
167 } | 167 } |
168 } | 168 } |
169 static const base::StringPiece systeminfo_html( | 169 static const base::StringPiece systeminfo_html( |
170 ResourceBundle::GetSharedInstance().GetRawDataResource( | 170 ResourceBundle::GetSharedInstance().GetRawDataResource( |
171 IDR_ABOUT_SYS_HTML)); | 171 IDR_ABOUT_SYS_HTML)); |
172 std::string full_html = webui::GetI18nTemplateHtml(systeminfo_html, &strings); | 172 std::string full_html = webui::GetI18nTemplateHtml(systeminfo_html, &strings); |
173 callback_.Run(base::RefCountedString::TakeString(&full_html)); | 173 callback_.Run(base::RefCountedString::TakeString(&full_html)); |
174 } | 174 } |
175 | 175 |
176 //////////////////////////////////////////////////////////////////////////////// | 176 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 19 matching lines...) Expand all Loading... |
196 | 196 |
197 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 197 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
198 SystemInfoHandler* handler = new SystemInfoHandler(); | 198 SystemInfoHandler* handler = new SystemInfoHandler(); |
199 web_ui->AddMessageHandler(handler); | 199 web_ui->AddMessageHandler(handler); |
200 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 200 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
201 | 201 |
202 // Set up the chrome://system/ source. | 202 // Set up the chrome://system/ source. |
203 Profile* profile = Profile::FromWebUI(web_ui); | 203 Profile* profile = Profile::FromWebUI(web_ui); |
204 content::URLDataSource::Add(profile, html_source); | 204 content::URLDataSource::Add(profile, html_source); |
205 } | 205 } |
OLD | NEW |