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

Side by Side Diff: chrome/browser/ui/webui/chromeos/system_info_ui.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc ('k') | chrome/browser/ui/webui/collected_cookies_ui_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698