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

Unified Diff: chrome/browser/ui/webui/options/options_ui.cc

Issue 7397021: Re-land r93365 - add RefCountedString (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit_tests 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/options_ui.cc
diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc
index b8eb57755361ff75323bb70f3d617d8175924aee..97c5a77ecd9d90a7f8db5380b1ee151dedaff882 100644
--- a/chrome/browser/ui/webui/options/options_ui.cc
+++ b/chrome/browser/ui/webui/options/options_ui.cc
@@ -115,38 +115,23 @@ OptionsUIHTMLSource::~OptionsUIHTMLSource() {}
void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
bool is_incognito,
int request_id) {
- scoped_refptr<RefCountedBytes> response_bytes(new RefCountedBytes);
+ std::string response;
SetFontAndTextDirection(localized_strings_.get());
if (path == kLocalizedStringsFile) {
// Return dynamically-generated strings from memory.
- std::string template_data;
- jstemplate_builder::AppendJsonJS(localized_strings_.get(), &template_data);
- response_bytes->data.resize(template_data.size());
- std::copy(template_data.begin(),
- template_data.end(),
- response_bytes->data.begin());
+ jstemplate_builder::AppendJsonJS(localized_strings_.get(), &response);
} else if (path == kOptionsBundleJsFile) {
// Return (and cache) the options javascript code.
- static const base::StringPiece options_javascript(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_OPTIONS_BUNDLE_JS));
- response_bytes->data.resize(options_javascript.size());
- std::copy(options_javascript.begin(),
- options_javascript.end(),
- response_bytes->data.begin());
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_OPTIONS_BUNDLE_JS).CopyToString(&response);
} else {
// Return (and cache) the main options html page as the default.
- static const base::StringPiece options_html(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_OPTIONS_HTML));
- response_bytes->data.resize(options_html.size());
- std::copy(options_html.begin(),
- options_html.end(),
- response_bytes->data.begin());
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_OPTIONS_HTML).CopyToString(&response);
Elliot Glaysher 2011/07/19 17:59:02 Both versions here are wrong. Data that comes fro
}
- SendResponse(request_id, response_bytes);
+ SendResponse(request_id, base::RefCountedString::TakeString(&response));
}
std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const {

Powered by Google App Engine
This is Rietveld 408576698