Chromium Code Reviews| 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 { |