| Index: chrome/browser/ui/webui/options/options_ui.cc
|
| ===================================================================
|
| --- chrome/browser/ui/webui/options/options_ui.cc (revision 84868)
|
| +++ chrome/browser/ui/webui/options/options_ui.cc (working copy)
|
| @@ -73,6 +73,8 @@
|
| #include "chrome/browser/ui/webui/options/certificate_manager_handler.h"
|
| #endif
|
|
|
| +static const char kLocalizedStringsFile[] = "strings.js";
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
| //
|
| // OptionsUIHTMLSource
|
| @@ -110,22 +112,33 @@
|
| void OptionsUIHTMLSource::StartDataRequest(const std::string& path,
|
| bool is_incognito,
|
| int request_id) {
|
| + scoped_refptr<RefCountedBytes> response_bytes(new RefCountedBytes);
|
| SetFontAndTextDirection(localized_strings_.get());
|
|
|
| - static const base::StringPiece options_html(
|
| - ResourceBundle::GetSharedInstance().GetRawDataResource(
|
| - IDR_OPTIONS_HTML));
|
| - const std::string full_html = jstemplate_builder::GetI18nTemplateHtml(
|
| - options_html, localized_strings_.get());
|
| + if (path == kLocalizedStringsFile) {
|
| + 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());
|
| + } else {
|
| + 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());
|
| + }
|
|
|
| - scoped_refptr<RefCountedBytes> html_bytes(new RefCountedBytes);
|
| - html_bytes->data.resize(full_html.size());
|
| - std::copy(full_html.begin(), full_html.end(), html_bytes->data.begin());
|
| -
|
| - SendResponse(request_id, html_bytes);
|
| + SendResponse(request_id, response_bytes);
|
| }
|
|
|
| -std::string OptionsUIHTMLSource::GetMimeType(const std::string&) const {
|
| +std::string OptionsUIHTMLSource::GetMimeType(const std::string& path) const {
|
| + if (path == kLocalizedStringsFile)
|
| + return "application/javascript";
|
| +
|
| return "text/html";
|
| }
|
|
|
|
|