| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_EXPAND)); | 145 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_EXPAND)); |
| 146 strings.SetString("collapseBtn", | 146 strings.SetString("collapseBtn", |
| 147 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_COLLAPSE)); | 147 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_COLLAPSE)); |
| 148 strings.SetString("parseError", | 148 strings.SetString("parseError", |
| 149 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_PARSE_ERROR)); | 149 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_PARSE_ERROR)); |
| 150 | 150 |
| 151 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 151 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 152 webui::SetLoadTimeDataDefaults(app_locale, &strings); | 152 webui::SetLoadTimeDataDefaults(app_locale, &strings); |
| 153 | 153 |
| 154 if (response_.get()) { | 154 if (response_.get()) { |
| 155 base::ListValue* details = new base::ListValue(); | 155 auto details = base::MakeUnique<base::ListValue>(); |
| 156 strings.Set("details", details); | |
| 157 for (SystemLogsResponse::const_iterator it = response_->begin(); | 156 for (SystemLogsResponse::const_iterator it = response_->begin(); |
| 158 it != response_->end(); | 157 it != response_->end(); |
| 159 ++it) { | 158 ++it) { |
| 160 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue); | 159 std::unique_ptr<base::DictionaryValue> val(new base::DictionaryValue); |
| 161 val->SetString("statName", it->first); | 160 val->SetString("statName", it->first); |
| 162 val->SetString("statValue", it->second); | 161 val->SetString("statValue", it->second); |
| 163 details->Append(std::move(val)); | 162 details->Append(std::move(val)); |
| 164 } | 163 } |
| 164 strings.Set("details", std::move(details)); |
| 165 } | 165 } |
| 166 static const base::StringPiece systeminfo_html( | 166 static const base::StringPiece systeminfo_html( |
| 167 ResourceBundle::GetSharedInstance().GetRawDataResource( | 167 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 168 IDR_ABOUT_SYS_HTML)); | 168 IDR_ABOUT_SYS_HTML)); |
| 169 std::string full_html = webui::GetI18nTemplateHtml(systeminfo_html, &strings); | 169 std::string full_html = webui::GetI18nTemplateHtml(systeminfo_html, &strings); |
| 170 callback_.Run(base::RefCountedString::TakeString(&full_html)); | 170 callback_.Run(base::RefCountedString::TakeString(&full_html)); |
| 171 } | 171 } |
| 172 | 172 |
| 173 //////////////////////////////////////////////////////////////////////////////// | 173 //////////////////////////////////////////////////////////////////////////////// |
| 174 // | 174 // |
| (...skipping 17 matching lines...) Expand all Loading... |
| 192 //////////////////////////////////////////////////////////////////////////////// | 192 //////////////////////////////////////////////////////////////////////////////// |
| 193 | 193 |
| 194 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 194 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 195 web_ui->AddMessageHandler(base::MakeUnique<SystemInfoHandler>()); | 195 web_ui->AddMessageHandler(base::MakeUnique<SystemInfoHandler>()); |
| 196 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 196 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
| 197 | 197 |
| 198 // Set up the chrome://system/ source. | 198 // Set up the chrome://system/ source. |
| 199 Profile* profile = Profile::FromWebUI(web_ui); | 199 Profile* profile = Profile::FromWebUI(web_ui); |
| 200 content::URLDataSource::Add(profile, html_source); | 200 content::URLDataSource::Add(profile, html_source); |
| 201 } | 201 } |
| OLD | NEW |