Commit d440e478 authored by dpapad's avatar dpapad Committed by Commit Bot

Replace usages of GetRawDataResource in c/b/search/.

GetRawDataResource assumes that underlying files are not compressed,
whereas LoadDataResourceString automatically decompresses if necessary.

This is one of many CLs, in preparation of compressing all HTML, JS,
CSS, SVG files by default (meaning without requiring compress="gzip"
to be specified).

Bug: 1068407
Change-Id: I1605422bd71e8712547ab93a29dff20e2f54c5f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2144457Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Commit-Queue: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758318}
parent 0ca80202
......@@ -1090,7 +1090,8 @@ void LocalNtpSource::StartDataRequest(
use_google_g_icon ? kGoogleGIconResourceName : kSearchIconResourceName;
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
base::StringPiece html = bundle.GetRawDataResource(IDR_LOCAL_NTP_HTML);
std::string html_string = bundle.LoadDataResourceString(IDR_LOCAL_NTP_HTML);
base::StringPiece html(html_string);
std::string replaced = ui::ReplaceTemplateExpressions(html, replacements);
std::move(callback).Run(base::RefCountedString::TakeString(&replaced));
return;
......
......@@ -180,9 +180,9 @@ void MostVisitedIframeSource::SendJSWithOrigin(
return;
}
base::StringPiece template_js =
ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
std::string response(template_js.as_string());
std::string response =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
resource_id);
base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin);
std::move(callback).Run(base::RefCountedString::TakeString(&response));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment