OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/system_info_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/system_info_ui.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 val->SetString("stat_name", it->first); | 133 val->SetString("stat_name", it->first); |
134 val->SetString("stat_value", it->second); | 134 val->SetString("stat_value", it->second); |
135 details->Append(val); | 135 details->Append(val); |
136 } | 136 } |
137 strings.SetString("anchor", path_); | 137 strings.SetString("anchor", path_); |
138 delete sys_info; | 138 delete sys_info; |
139 } | 139 } |
140 static const base::StringPiece systeminfo_html( | 140 static const base::StringPiece systeminfo_html( |
141 ResourceBundle::GetSharedInstance().GetRawDataResource( | 141 ResourceBundle::GetSharedInstance().GetRawDataResource( |
142 IDR_ABOUT_SYS_HTML)); | 142 IDR_ABOUT_SYS_HTML)); |
143 const std::string full_html = jstemplate_builder::GetTemplatesHtml( | 143 std::string full_html = jstemplate_builder::GetTemplatesHtml( |
144 systeminfo_html, &strings, "t" /* template root node id */); | 144 systeminfo_html, &strings, "t" /* template root node id */); |
145 | 145 |
146 scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes); | 146 SendResponse(request_id_, base::RefCountedString::TakeString(&full_html)); |
147 html_bytes->data.resize(full_html.size()); | |
148 std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin()); | |
149 | |
150 SendResponse(request_id_, html_bytes); | |
151 } | 147 } |
152 | 148 |
153 //////////////////////////////////////////////////////////////////////////////// | 149 //////////////////////////////////////////////////////////////////////////////// |
154 // | 150 // |
155 // SystemInfoHandler | 151 // SystemInfoHandler |
156 // | 152 // |
157 //////////////////////////////////////////////////////////////////////////////// | 153 //////////////////////////////////////////////////////////////////////////////// |
158 SystemInfoHandler::SystemInfoHandler() { | 154 SystemInfoHandler::SystemInfoHandler() { |
159 } | 155 } |
160 | 156 |
(...skipping 16 matching lines...) Expand all Loading... |
177 //////////////////////////////////////////////////////////////////////////////// | 173 //////////////////////////////////////////////////////////////////////////////// |
178 | 174 |
179 SystemInfoUI::SystemInfoUI(TabContents* contents) : ChromeWebUI(contents) { | 175 SystemInfoUI::SystemInfoUI(TabContents* contents) : ChromeWebUI(contents) { |
180 SystemInfoHandler* handler = new SystemInfoHandler(); | 176 SystemInfoHandler* handler = new SystemInfoHandler(); |
181 AddMessageHandler((handler)->Attach(this)); | 177 AddMessageHandler((handler)->Attach(this)); |
182 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); | 178 SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); |
183 | 179 |
184 // Set up the chrome://system/ source. | 180 // Set up the chrome://system/ source. |
185 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); | 181 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source); |
186 } | 182 } |
OLD | NEW |