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 <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
14 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 callback_ = callback; | 112 callback_ = callback; |
111 | 113 |
112 AboutSystemLogsFetcher* fetcher = new AboutSystemLogsFetcher(); | 114 AboutSystemLogsFetcher* fetcher = new AboutSystemLogsFetcher(); |
113 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, | 115 fetcher->Fetch(base::Bind(&SystemInfoUIHTMLSource::SysInfoComplete, |
114 weak_ptr_factory_.GetWeakPtr())); | 116 weak_ptr_factory_.GetWeakPtr())); |
115 } | 117 } |
116 | 118 |
117 | 119 |
118 void SystemInfoUIHTMLSource::SysInfoComplete( | 120 void SystemInfoUIHTMLSource::SysInfoComplete( |
119 scoped_ptr<SystemLogsResponse> sys_info) { | 121 scoped_ptr<SystemLogsResponse> sys_info) { |
120 response_ = sys_info.Pass(); | 122 response_ = std::move(sys_info); |
121 RequestComplete(); | 123 RequestComplete(); |
122 } | 124 } |
123 | 125 |
124 void SystemInfoUIHTMLSource::RequestComplete() { | 126 void SystemInfoUIHTMLSource::RequestComplete() { |
125 base::DictionaryValue strings; | 127 base::DictionaryValue strings; |
126 strings.SetString("title", l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TITLE)); | 128 strings.SetString("title", l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TITLE)); |
127 strings.SetString("description", | 129 strings.SetString("description", |
128 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_DESC)); | 130 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_DESC)); |
129 strings.SetString("tableTitle", | 131 strings.SetString("tableTitle", |
130 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TABLE_TITLE)); | 132 l10n_util::GetStringUTF16(IDS_ABOUT_SYS_TABLE_TITLE)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 189 |
188 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 190 SystemInfoUI::SystemInfoUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
189 SystemInfoHandler* handler = new SystemInfoHandler(); | 191 SystemInfoHandler* handler = new SystemInfoHandler(); |
190 web_ui->AddMessageHandler(handler); | 192 web_ui->AddMessageHandler(handler); |
191 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 193 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
192 | 194 |
193 // Set up the chrome://system/ source. | 195 // Set up the chrome://system/ source. |
194 Profile* profile = Profile::FromWebUI(web_ui); | 196 Profile* profile = Profile::FromWebUI(web_ui); |
195 content::URLDataSource::Add(profile, html_source); | 197 content::URLDataSource::Add(profile, html_source); |
196 } | 198 } |
OLD | NEW |