| 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 0ace5df7f70759af5c5b042c10be3dc9caf46d63..de75ec6cf1f00c965496d3f821e063c22fb8a4de 100644
|
| --- a/chrome/browser/ui/webui/options/options_ui.cc
|
| +++ b/chrome/browser/ui/webui/options/options_ui.cc
|
| @@ -116,35 +116,22 @@ OptionsUIHTMLSource::~OptionsUIHTMLSource() {}
|
| void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
|
| bool is_incognito,
|
| int request_id) {
|
| - scoped_refptr<RefCountedBytes> response_bytes(new RefCountedBytes);
|
| + scoped_refptr<RefCountedMemory> response_bytes;
|
| 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());
|
| + std::string strings_js;
|
| + jstemplate_builder::AppendJsonJS(localized_strings_.get(), &strings_js);
|
| + response_bytes = base::RefCountedString::TakeString(&strings_js);
|
| } 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());
|
| + response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
|
| + IDR_OPTIONS_BUNDLE_JS);
|
| } 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());
|
| + response_bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes(
|
| + IDR_OPTIONS_HTML);
|
| }
|
|
|
| SendResponse(request_id, response_bytes);
|
|
|