| Index: chrome/browser/ui/webui/about_ui.cc
|
| diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc
|
| index 8985b91ff58f3365d4af76296cd37b23d6756a45..2b3f3e67dfc786ca59b6323610f44c460ee3d6fd 100644
|
| --- a/chrome/browser/ui/webui/about_ui.cc
|
| +++ b/chrome/browser/ui/webui/about_ui.cc
|
| @@ -63,6 +63,7 @@
|
| #include "net/http/http_response_headers.h"
|
| #include "net/url_request/url_fetcher.h"
|
| #include "net/url_request/url_request_status.h"
|
| +#include "third_party/brotli/dec/decode.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "ui/base/webui/jstemplate_builder.h"
|
| @@ -760,8 +761,25 @@ void AboutUIHTMLSource::StartDataRequest(
|
| idr = IDR_KEYBOARD_UTILS_JS;
|
| #endif
|
|
|
| - response = ResourceBundle::GetSharedInstance().GetRawDataResource(
|
| - idr).as_string();
|
| + base::StringPiece raw_response =
|
| + ResourceBundle::GetSharedInstance().GetRawDataResource(idr);
|
| + if (idr == IDR_ABOUT_UI_CREDITS_HTML) {
|
| + size_t decoded_size;
|
| + const uint8_t* encoded_response_buffer =
|
| + reinterpret_cast<const uint8_t*>(raw_response.data());
|
| + CHECK(BrotliDecompressedSize(raw_response.size(), encoded_response_buffer,
|
| + &decoded_size));
|
| +
|
| + // Resizing the response and using it as the buffer Brotli decompresses
|
| + // into.
|
| + response.resize(decoded_size);
|
| + CHECK(BrotliDecompressBuffer(raw_response.size(), encoded_response_buffer,
|
| + &decoded_size,
|
| + reinterpret_cast<uint8_t*>(&response[0])) ==
|
| + BROTLI_RESULT_SUCCESS);
|
| + } else {
|
| + response = raw_response.as_string();
|
| + }
|
| #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS)
|
| } else if (source_name_ == chrome::kChromeUIDiscardsHost) {
|
| response = AboutDiscards(path);
|
|
|